function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CodeBearCodeBear 

System.Callout.Exception at WebServiceCallout.invoke for method in WSDL2Apex Generated Code

Using the API guide example code for one of the StrikeIron Services:

// Create the stub

strikeironIplookup.DNSSoap dns = new strikeironIplookup.DNSSoap();

// Set up the license header

dns.LicenseInfo = new strikeiron.LicenseInfo();
dns.LicenseInfo.RegisteredUser = new strikeiron.RegisteredUser();
dns.LicenseInfo.RegisteredUser.UserID = 'you@company.com';
dns.LicenseInfo.RegisteredUser.Password = 'your-password';

// Make the Web service call

strikeironIplookup.DNSInfo info = dns.DNSLookup('www.google.com');

Where strikeiron and strikeironiplookup are classes generated by the WSDL downloaded from http://ws.strikeiron.com/relauto/iplookup?WSDL.

When I plugin my StrikeIron credentials into the above, this works just fine, and the web service call is successful.

If, however, I add:

dns.GetRemainingHits();

I get the exception:
22:11:23 ERROR - Evaluation error: System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://ws.strikeiron.com:GetRemainingHitsResponse' but found 'http://schemas.xmlsoap.org/soap/envelope/:Body'
22:11:23 ERROR - Evaluation error: Class.strikeironIplookup.DNSSoap.GetRemainingHits: line 70, column 13
AnonymousBlock: line 15, column 3
22:11:23 ERROR - Evaluation error: Class.strikeironIplookup.DNSSoap.GetRemainingHits: line 70, column 13 AnonymousBlock: line 15, column 3

Line 70 refers to the line with WebServiceCallout.invoke for GetRemainingHits().

I have had similar problems with other StrikeIron WSDL GetRemaingHits(), and also for some other web services (all the Parsing Error like the above), and not all of the methods are a void return, as GetRemainingHits is, so it is not just the return type.

How Can I debug this? Any assistance you can provide is greatly appreciated.
davoskidavoski

Hey, wondering did you get any resolution to this. Having the same problem! Any help would be greatly appreciated