I'm having an issue with the Address Verification method available through StrikeIron. I imported the following WSDL and am using the generated wsdl2apex code.
The WSDL I'm using is here: http://wsparam.strikeiron.com/USAddressVerification5?WSDL
I'm calling the VerifyAddressUSA method like this(took out my real credentails):
StrikeIron.USAddressVerificationSoap stub= new StrikeIron.USAddressVerificationSoap();
StrikeIron.VerifyAddressUSAResponse_element response = new StrikeIron.VerifyAddressUSAResponse_element();
response=stub.VerifyAddressUSA('','MYEMAIL@MYDOMAIN.COM', 'PASSWORD', '1600 Pennsylvania Avenue', '', ' Washington, DC 20500', '', '', 'PROPER');
The error I'm getting is:
System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://www.strikeiron.com=AddressLine1
Any ideas on how to solve this? I'm not sure where the problem is.
Thanks!
EDIT(code for VerifyAddressUSA):
public StrikeIron.VerifyAddressUSAResponse_element VerifyAddressUSA(String UnregisteredUserEmail,String UserID,String Password,String AddressLine1,String AddressLine2,String CityStateZIPCode,String Firm,String Urbanization,String Casing) {
StrikeIron.VerifyAddressUSA_element request_x = new StrikeIron.VerifyAddressUSA_element();
StrikeIron.VerifyAddressUSAResponse_element response_x;
request_x.UnregisteredUserEmail = UnregisteredUserEmail;
request_x.UserID = UserID;
request_x.Password = Password;
request_x.AddressLine1 = AddressLine1;
request_x.AddressLine2 = AddressLine2;
request_x.CityStateZIPCode = CityStateZIPCode;
request_x.Firm = Firm;
request_x.Urbanization = Urbanization;
request_x.Casing = Casing;
Map<String, StrikeIron.VerifyAddressUSAResponse_element> response_map_x = new Map<String, StrikeIron.VerifyAddressUSAResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'http://www.strikeiron.com/VerifyAddressUSA',
'http://www.strikeiron.com',
'VerifyAddressUSA',
'http://www.strikeiron.com',
'VerifyAddressUSAResponse',
'StrikeIron.VerifyAddressUSAResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x;
}
VerifyAddressUSAResonse_element
public class VerifyAddressUSAResponse_element {
public StrikeIron.SIWsOutputOfUSAddress VerifyAddressUSAResult;
public StrikeIron.SISubscriptionInfo SISubscriptionInfo;
private String[] VerifyAddressUSAResult_type_info = new String[]{'VerifyAddressUSAResult','http://www.strikeiron.com','SIWsOutputOfUSAddress','0','1','false'};
private String[] SISubscriptionInfo_type_info = new String[]{'SISubscriptionInfo','http://www.strikeiron.com','SISubscriptionInfo','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true','false'};
private String[] field_order_type_info = new String[]{'VerifyAddressUSAResult','SISubscriptionInfo'};
}
VerifyAddressUSA_element
public class VerifyAddressUSA_element {
public String UnregisteredUserEmail;
public String UserID;
public String Password;
public String AddressLine1;
public String AddressLine2;
public String CityStateZIPCode;
public String Firm;
public String Urbanization;
public String Casing;
private String[] UnregisteredUserEmail_type_info = new String[]{'UnregisteredUserEmail','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] UserID_type_info = new String[]{'UserID','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Password_type_info = new String[]{'Password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] AddressLine1_type_info = new String[]{'AddressLine1','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] AddressLine2_type_info = new String[]{'AddressLine2','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] CityStateZIPCode_type_info = new String[]{'CityStateZIPCode','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Firm_type_info = new String[]{'Firm','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Urbanization_type_info = new String[]{'Urbanization','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] Casing_type_info = new String[]{'Casing','http://www.strikeiron.com','CasingEnum','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://www.strikeiron.com','true','false'};
private String[] field_order_type_info = new String[]{'UnregisteredUserEmail','UserID','Password','AddressLine1','AddressLine2','CityStateZIPCode','Firm','Urbanization','Casing'};
}
Attribution to: Phil B
Possible Suggestion/Solution #1
Sounds like the WSDL to APEX generator didn't properly generate the member: AddressLine1
in your response type. Or it gave it the wrong type.
The name of the class we need is called something like: VerifyAddressUSAResult
(and it's parent class if any)
Attribution to: jordan.baucke
Possible Suggestion/Solution #2
Note, the following ideas won't directly solve your issue, but it may lead to the cause.
You could try a couple of thinks:
- Invoking the web service independently of Salesforce. This will help confirm that it is operating as you expect and that the crediantals are valid.
- Examining the callout request and response from the apex log
I've been using soapUI to invoke web services and verify the responses. After installing soapUI, import the WSDL into a new project.
You can then manually fill out the sample request and send it off.
This should help verify that the web service is responding as expected. E.g.
Next I would check the the CALLOUT_REQUEST and CALLOUT_RESPONSE that get logged in a developer edition org with calls to WebServiceCallout.invoke. It would be useful to compare these to the request and the response in soapUI.
For example, when I tried importing the WSDL and calling it with your example code and my credentials I got:
For what it is worth, I got the same error you did:
System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://www.strikeiron.com =AddressLine1
Class.wwwStrikeironCom.USAddressVerificationSoap.VerifyAddressUSA: line 471, column 1 AnonymousBlock: line 3, column 1
Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/2146