• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Deserializing complex types when consuming web services
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deserializing complex types when consuming web services


  • Subject: Deserializing complex types when consuming web services
  • From: Thomas <email@hidden>
  • Date: Thu, 6 Mar 2008 10:09:36 +1100

This is my first attempt at consuming complex types. I've done simple types in the past successfully, but I'm stuck when trying to deserialize the result of a Telesign call. This is a commercial service that rings a given phone number and speaks some code so the called person can enter the code in a web form to prove that they are at that phone. I am successfully causing phone calls to happen, but failing to parse the SOAP result.

The WSDL for this service is at the bottom. I have made classes for some important elements specified in the WSDL, (with getters and setters for their attributes):

Call ( ReferenceID, APIErrorResponse)

APIErrorResponse ( Code, Message )

These two classes are registered with code like this:

qName = new QName("https://www.telesign.com/api/";, "Call");
serializer = new BeanSerializerFactory(Call.class, qName);
deserializer = new BeanDeserializerFactory(Call.class, qName);
WOWebServiceClient client = new WOWebServiceClient(new URL(_service_address));
client.registerFactoriesForClassWithQName( serializer, deserializer, Call.class, qName);



An example class for Call is also below. This has the required attributes and getters and setters, but when running the RequestCALL service I get the exception below (in the response; the call is made successfully), which says the ReferenceID element is invalid.


As far as I can tell, I've done everything necessary to deserialize the Call object and its immediate child APIErrorResponse, but it's complaining about a simple String element/attribute with a name that seems right.

Any help in pointing me in the right direction would be appreciated.

Regards
Thomas


-------------- Exception -----------

org.xml.sax.SAXException: Invalid element in biz.webjini.Call - ReferenceID:Exception trying to invoke operation: RequestCALL
at com .webobjects .webservices.client.WOWebServiceClient.invoke(WOWebServiceClient.java: 491)
at biz.webjini.TelesignWebService.invoke(TelesignWebService.java:110)




-------------- Call.java -----------

package biz.webjini;

import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import javax.xml.namespace.QName;

import com.webobjects.webservices.client.WOWebServiceClient;

public class Call implements java.io.Serializable {

	public String ReferenceID;
	public APIErrorResponse APIError;

	public String getReferenceID() {
		return ReferenceID;
	}

	public void setReferenceID(String id) {
		ReferenceID = id;
	}

	public APIErrorResponse getAPIError() {
		return APIError;
	}

	public void setAPIError(APIErrorResponse error) {
		APIError = error;
	}

}



------------- WSDL --------------
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:s="http://www.w3.org/2001/XMLSchema " xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:tns="https://www.telesign.com/api/ " xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/ " targetNamespace="https://www.telesign.com/api/"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/ ">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="https://www.telesign.com/api/ ">
<s:element name="RequestAPIversion">
<s:complexType />
</s:element>
<s:element name="RequestAPIversionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestAPIversionResult" type="tns:Version" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Version">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Number" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="RequestSMS">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AuthenticationID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PhoneNumber" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Language" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="VerificationCode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestSMSResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestSMSResult" type="tns:SMS" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="SMS">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ReferenceID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="APIError" type="tns:APIErrorResponse" />
</s:sequence>
</s:complexType>
<s:complexType name="APIErrorResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Code" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="RequestPhoneID">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AuthenticationID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PhoneNumber" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestPhoneIDResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestPhoneIDResult" type="tns:PhoneID" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="PhoneID">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="OriginalPhoneNumber" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CleansedPhoneNumber" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CleansedCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="City" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="State" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PrimaryMetroCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="County" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TimeZone" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TimeZoneUTCMin" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TimeZoneUTCMax" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Latitude" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Longitude" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CountryName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="MinNumLength" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="MaxNumLength" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ReferenceID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="TypeofPhone" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="APIError" type="tns:APIErrorResponse" />
</s:sequence>
</s:complexType>
<s:element name="RequestSTATUS">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AuthenticationID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ReferenceID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="VerificationCode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestSTATUSResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestSTATUSResult" type="tns:STATUS" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="STATUS">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="StatusCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="VerificationCodeValid" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Additional" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="KeyPress" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="APIError" type="tns:APIErrorResponse" />
</s:sequence>
</s:complexType>
<s:element name="RequestCALL">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CustomerID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="AuthenticationID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CountryCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PhoneNumber" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Language" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="VerificationCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Priority" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DelayTime" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="RedialCount" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ExtensionContent" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ExtensionType" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Message" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CallType" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CallerID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Project" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Additional" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestCALLResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestCALLResult" type="tns:Call" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="Call">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ReferenceID" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="APIError" type="tns:APIErrorResponse" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="RequestAPIversionSoapIn">
<wsdl:part name="parameters" element="tns:RequestAPIversion" />
</wsdl:message>
<wsdl:message name="RequestAPIversionSoapOut">
<wsdl:part name="parameters" element="tns:RequestAPIversionResponse" />
</wsdl:message>
<wsdl:message name="RequestSMSSoapIn">
<wsdl:part name="parameters" element="tns:RequestSMS" />
</wsdl:message>
<wsdl:message name="RequestSMSSoapOut">
<wsdl:part name="parameters" element="tns:RequestSMSResponse" />
</wsdl:message>
<wsdl:message name="RequestPhoneIDSoapIn">
<wsdl:part name="parameters" element="tns:RequestPhoneID" />
</wsdl:message>
<wsdl:message name="RequestPhoneIDSoapOut">
<wsdl:part name="parameters" element="tns:RequestPhoneIDResponse" />
</wsdl:message>
<wsdl:message name="RequestSTATUSSoapIn">
<wsdl:part name="parameters" element="tns:RequestSTATUS" />
</wsdl:message>
<wsdl:message name="RequestSTATUSSoapOut">
<wsdl:part name="parameters" element="tns:RequestSTATUSResponse" />
</wsdl:message>
<wsdl:message name="RequestCALLSoapIn">
<wsdl:part name="parameters" element="tns:RequestCALL" />
</wsdl:message>
<wsdl:message name="RequestCALLSoapOut">
<wsdl:part name="parameters" element="tns:RequestCALLResponse" />
</wsdl:message>
<wsdl:portType name="TelesignAPISoap">
<wsdl:operation name="RequestAPIversion">
<wsdl:input message="tns:RequestAPIversionSoapIn" />
<wsdl:output message="tns:RequestAPIversionSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestSMS">
<wsdl:input message="tns:RequestSMSSoapIn" />
<wsdl:output message="tns:RequestSMSSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestPhoneID">
<wsdl:input message="tns:RequestPhoneIDSoapIn" />
<wsdl:output message="tns:RequestPhoneIDSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestSTATUS">
<wsdl:input message="tns:RequestSTATUSSoapIn" />
<wsdl:output message="tns:RequestSTATUSSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestCALL">
<wsdl:input message="tns:RequestCALLSoapIn" />
<wsdl:output message="tns:RequestCALLSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TelesignAPISoap" type="tns:TelesignAPISoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"; style="document" />
<wsdl:operation name="RequestAPIversion">
<soap:operation soapAction="https://www.telesign.com/api/RequestAPIversion " style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestSMS">
<soap:operation soapAction="https://www.telesign.com/api/RequestSMS " style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestPhoneID">
<soap:operation soapAction="https://www.telesign.com/api/RequestPhoneID " style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestSTATUS">
<soap:operation soapAction="https://www.telesign.com/api/RequestSTATUS " style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestCALL">
<soap:operation soapAction="https://www.telesign.com/api/RequestCALL " style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TelesignAPI">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/";>Telesign Application Programming Interface (API) - Simple Object Access Protocol (SOAP)</documentation>
<wsdl:port name="TelesignAPISoap" binding="tns:TelesignAPISoap">
<soap:address location="http://www.telesign.com/api/soap.asmx"; />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Deserializing complex types when consuming web services
      • From: Lachlan Deck <email@hidden>
  • Prev by Date: Re: Lifebeat
  • Next by Date: Re: Running WO5.4 on Leopard
  • Previous by thread: Re: one sided many-to-many?
  • Next by thread: Re: Deserializing complex types when consuming web services
  • Index(es):
    • Date
    • Thread