8

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('','[email protected]', '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'};
}
7
  • The total generated apex is over 500 lines long. I'll add the VerifyAddressUSABatch method to my original post though.
    – Phil B
    Oct 10, 2012 at 15:06
  • So VerifyAddressUSAResult and SISubscriptionInfo, in my mind VerifyAddressUSAResult is the type that the APEX can't properly be deserialized into...check the types on AddressLine1 to make sure it is of the type string and that it exists! Oct 10, 2012 at 15:45
  • I added VerifyAddressUSA_element to my original post above and AddressLine1 appears to be there and a string
    – Phil B
    Oct 10, 2012 at 15:54
  • Yeah, but the type VerifyAddressUSAResult is really what we're looking for -- VerifyAddressUSA_element is like a deserlialization go between. You didn't modify any of the classes after you created them? And have you reviewed the debug logs and examined the SOAP message that is being returned? Oct 10, 2012 at 16:08
  • Yep, thats exactly what I thought. VerifyAddressUSAResult only exists in the VerifyAddressUSA_element. I did a ctrl+f and thats it. I'm guessing the deserialization is going on behind the scenes? I was checking the debug logs and I can't get it to display what it being returned. The only modification I had made to the class was adding a debug statement in an attempt to see the response and I have since removed it.
    – Phil B
    Oct 10, 2012 at 16:15

2 Answers 2

6

Note, the following ideas won't directly solve your issue, but it may lead to the cause.

You could try a couple of thinks:

  1. Invoking the web service independently of Salesforce. This will help confirm that it is operating as you expect and that the crediantals are valid.
  2. 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.

soapUI project for strikeiron

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.

soapUI request and response

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:

CALLOUT_REQUEST and CALLOUT_RESPONSE

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

4
  • Thanks, I actually ended up testing with SOAP UI as well. I also tried using the batch address verification and got a slightly different error for 'itemstatus' instead of 'address1'. I ended up just ignoring the generated wsdl2apex code and doing it all manually. Thanks for the help everyone!
    – Phil B
    Oct 10, 2012 at 19:46
  • Just to expand on this a little in case anyone else runs into this. I created a HttpRequest, set the header info, built my XML with the XMLStreamWriter and added on the SOAP header and footer. I then sent it over and will be parsing the response as well with XmlStreamReader.
    – Phil B
    Oct 10, 2012 at 19:50
  • 1
    Great to hear you got something working. I suspect there is something off with the XML namespaces. Either in the WSDL, the SOAP response or the class generated by wsdl2apex. Probably the latter based on experience. Oct 10, 2012 at 19:53
  • I've found the Apex generated code is very particular about what it can consume web service wise. Things like names and certain data structures are incompatible. Oct 11, 2012 at 1:36
0

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)

4
  • I believe VerifyAddressUSABatch is a batch version of VerifyAddressUSA that allows you to send over multiple addresses for validation instead of just one. I'll add VerifyAddressUSAResponse_element to my original. Hopefully that helps?
    – Phil B
    Oct 10, 2012 at 15:39
  • Oops, my fault I did paste in the batch version instead of the normal version I'll fix it.
    – Phil B
    Oct 10, 2012 at 15:43
  • Sorry yeah, that was a quick guess based on the code I could see. There should be a public member of the type that your response is ultimately de-seralized into at the top of the VerifyAddressUSAResponse_element class... Oct 10, 2012 at 15:44
  • I added VerifyAddressUSAResponse_element to my originial, let me know if theres another class you'd like to seee, I tried pasting the whole thing and it was over the character limit.
    – Phil B
    Oct 10, 2012 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .