I am trying to create stubs (java files) from an existing WSDL in switchyard and getting the exception : java.lang.reflect.InvocationTargetException
Steps:
I created a switchyard project in JBDS and placed the wsdl in resources folder. Then I did New -> Others -> SwitchYard -> Java Files from WSDL
I select the package and browse for the wsdl file.
When I click on Finish, I get a pop up with an error java.lang.reflect.InvocationTargetException and it won't create the java files
I have attached the error and the wsdl files.
Please let me know how to fix the issue. Is there something wrong I am doing to create generate the java files. Please let me know.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mx="http://www.ibm.com/maximo" xmlns:mxws="http://www.ibm.com/maximo/wsdl/web_MXINCIDENT_WS" targetNamespace="http://www.ibm.com/maximo/wsdl/web_MXINCIDENT_WS" name="web_MXINCIDENT_WS">
<types>
<xsd:schema xmlns="http://www.ibm.com/maximo" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.ibm.com/maximo">
<xsd:include schemaLocation="common/MXMeta.xsd" />
<xsd:include schemaLocation="MXINCIDENT_WSTB.xsd" />
<xsd:include schemaLocation="common/mxincident_wst.xsd" />
<xsd:complexType name="CreateMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="InvokeMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="QueryMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBQuery" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
<xsd:attributeGroup ref="QueryContentGroup" />
</xsd:complexType>
<xsd:complexType name="SyncMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="PublishMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
<xsd:attributeGroup ref="PublishingContentGroup" />
</xsd:complexType>
<xsd:complexType name="UpdateMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="DeleteMXINCIDENT_WSTBType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="InvokeMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="CreateMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element name="MXINCIDENT_WSTBSet" type="MXINCIDENT_WSTBCombinedKeySetType" minOccurs="0" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="QueryMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element ref="MXINCIDENT_WSTBSet" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
<xsd:attributeGroup ref="ResponseContentGroup" />
</xsd:complexType>
<xsd:complexType name="SyncMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element name="MXINCIDENT_WSTBSet" type="MXINCIDENT_WSTBCombinedKeySetType" minOccurs="0" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="DeleteMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element name="MXINCIDENT_WSTBSet" type="MXINCIDENT_WSTBCombinedKeySetType" minOccurs="0" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:complexType name="UpdateMXINCIDENT_WSTBResponseType">
<xsd:sequence>
<xsd:element name="MXINCIDENT_WSTBSet" type="MXINCIDENT_WSTBCombinedKeySetType" minOccurs="0" />
</xsd:sequence>
<xsd:attributeGroup ref="CommonContentGroup" />
</xsd:complexType>
<xsd:element name="UpdateMXINCIDENT_WSTB" type="UpdateMXINCIDENT_WSTBType" />
<xsd:element name="QueryMXINCIDENT_WSTB" type="QueryMXINCIDENT_WSTBType" />
<xsd:element name="CreateMXINCIDENT_WSTB" type="CreateMXINCIDENT_WSTBType" />
<xsd:element name="SyncMXINCIDENT_WSTB" type="SyncMXINCIDENT_WSTBType" />
<xsd:element name="DeleteMXINCIDENT_WSTB" type="DeleteMXINCIDENT_WSTBType" />
<xsd:element name="PublishMXINCIDENT_WSTB" type="PublishMXINCIDENT_WSTBType" />
<xsd:element name="InvokeMXINCIDENT_WSTB" type="InvokeMXINCIDENT_WSTBType" />
<xsd:element name="InvokeMXINCIDENT_WSTBResponse" type="InvokeMXINCIDENT_WSTBResponseType" />
<xsd:element name="QueryMXINCIDENT_WSTBResponse" type="QueryMXINCIDENT_WSTBResponseType" />
<xsd:element name="CreateMXINCIDENT_WSTBResponse" type="CreateMXINCIDENT_WSTBResponseType" />
<xsd:element name="SyncMXINCIDENT_WSTBResponse" type="SyncMXINCIDENT_WSTBResponseType" />
<xsd:element name="UpdateMXINCIDENT_WSTBResponse" type="UpdateMXINCIDENT_WSTBResponseType" />
<xsd:element name="DeleteMXINCIDENT_WSTBResponse" type="DeleteMXINCIDENT_WSTBResponseType" />
</xsd:schema>
</types>
<portType name="web_MXINCIDENT_WSPortType">
<operation name="CreateMXINCIDENT_WSTB">
<input message="mxws:CreateMXINCIDENT_WSTBRequest" />
<output message="mxws:CreateMXINCIDENT_WSTBResponse" />
</operation>
</portType>
<binding name="web_MXINCIDENT_WSSOAP11Binding" type="mxws:web_MXINCIDENT_WSPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="CreateMXINCIDENT_WSTB">
<soap:operation soapAction="urn:processDocument" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<binding name="web_MXINCIDENT_WSSOAP12Binding" type="mxws:web_MXINCIDENT_WSPortType">
<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="CreateMXINCIDENT_WSTB">
<soap12:operation soapAction="urn:processDocument" style="document" />
<input>
<soap12:body use="literal" />
</input>
<output>
<soap12:body use="literal" />
</output>
</operation>
</binding>
<message name="CreateMXINCIDENT_WSTBRequest">
<part name="parameters" element="mx:CreateMXINCIDENT_WSTB" />
</message>
<message name="CreateMXINCIDENT_WSTBResponse">
<part name="parameters" element="mx:CreateMXINCIDENT_WSTBResponse" />
</message>
<service name="web_MXINCIDENT_WS">
<port name="web_MXINCIDENT_WSSOAP11Port" binding="mxws:web_MXINCIDENT_WSSOAP11Binding">
<soap:address location="http://192.168.44.65:9080/meaweb/services/web_MXINCIDENT_WS" />
</port>
<port name="web_MXINCIDENT_WSSOAP12Port" binding="mxws:web_MXINCIDENT_WSSOAP12Binding">
<soap12:address location="http://192.168.44.65:9080/meaweb/services/web_MXINCIDENT_WS" />
</port>
</service>
</definitions>
Finally I was able to figure out the issue.
What I realized is,
if the WSDL is not proper you will get this exception which I was getting in my case.
In my wsdl there were two xsd's required which was missing from the specified location. After adding those two xsd's I was able to generate the stubs.
Reference : https://developer.jboss.org/message/918130
Related
How do I add a new .resx (plus .Designer.cs) file to my project using the dotnet CLI or VS Code?
I couldn't find a template either, it'd be nice if the community could make a new template we could install or even have it as one of the default templates.
Here is the sample XML provided for reference (took me a while to find it)
The file is named Foo.resx, and then you can copy paste it for each language Foo.fr.resx or even Foo.fr-fr.resx
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PageTitle" xml:space="preserve">
<value>My page title in english</value>
</data>
</root>
For each file I have the following entry in my csproj
<ItemGroup>
<EmbeddedResource Update="Pages\Foo.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Foo.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
Lastly, for balzor wasm, the resource name matches the page name.
I'm trying to get soapUI to recognize the types in my ServiceStack soap service. I'm sure that I'm doing something wrong in the setup of the service. Here is the WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="Soap12"
targetNamespace="https://something.com/service/types"
xmlns:svc="https://something.com/service/types"
xmlns:tns="https://something.com/service/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsdl:types>
<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
</wsdl:types>
<wsdl:message name="IsAvailableRequestIn">
<wsdl:part name="parameters" element="tns:IsAvailableRequest" />
</wsdl:message>
<wsdl:message name="IsAvailableRequestOut">
<wsdl:part name="parameters" element="tns:IsAvailableRequestResponse" />
</wsdl:message>
<wsdl:portType name="ISyncReply">
<wsdl:operation name="IsAvailableRequest">
<wsdl:input message="svc:IsAvailableRequestIn" />
<wsdl:output message="svc:IsAvailableRequestOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="IOneWay">
</wsdl:portType>
<wsdl:binding name="WSHttpBinding_ISyncReply" type="svc:ISyncReply">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="IsAvailableRequest">
<soap:operation soapAction="https://something.com/service/types/IsAvailableRequest" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WSHttpBinding_IOneWay" type="svc:IOneWay">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
</wsdl:binding>
<wsdl:service name="SyncReply">
<wsdl:port name="WSHttpBinding_ISyncReply" binding="svc:WSHttpBinding_ISyncReply">
<soap:address location="http://beta.something.com/service/soap12" />
</wsdl:port>
</wsdl:service>
<wsdl:service name="AsyncOneWay">
<wsdl:port name="WSHttpBinding_IOneWay" binding="svc:WSHttpBinding_IOneWay">
<soap:address location="http://beta.something.com/service/soap12" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Notice that it doesn't include the type information (I dunno, should it?) Here is the type schema:
<?xml version="1.0"?>
<xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/SomethingWeb" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/SomethingWeb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="IsAvailableRequest">
<xs:sequence>
<xs:element minOccurs="0" name="ClientID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Token" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="IsAvailableRequest" nillable="true" type="tns:IsAvailableRequest" />
<xs:complexType name="IsAvailableResponse">
<xs:sequence>
<xs:element minOccurs="0" name="Available" nillable="true" type="tns:ArrayOfAvailableData" />
<xs:element minOccurs="0" name="ClientID" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Location" nillable="true" type="tns:Location" />
<xs:element minOccurs="0" name="Message" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Request" nillable="true" type="tns:IsAvailableRequest" />
<xs:element minOccurs="0" name="ReturnCode" type="xs:int" />
<xs:element minOccurs="0" name="Token" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="IsAvailableResponse" nillable="true" type="tns:IsAvailableResponse" />
<xs:complexType name="ArrayOfAvailableData">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="AvailableData" nillable="true" type="tns:AvailableData" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfAvailableData" nillable="true" type="tns:ArrayOfAvailableData" />
<xs:complexType name="AvailableData">
<xs:sequence>
<xs:element minOccurs="0" name="Code" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Label" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="AvailableData" nillable="true" type="tns:AvailableData" />
<xs:complexType name="Location">
<xs:sequence>
<xs:element minOccurs="0" name="Result" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="Location" nillable="true" type="tns:Location" />
</xs:schema>
How do I get soapUI (and by extension, other java code) to understand my schema?
I just had this problem and sorted it out by adding a default namespace in AppHost via
SetConfig(new EndpointHostConfig {
WsdlServiceNamespace = "http://my.new.namespace.com/types",
});
And decorating my models with
[DataContract(Namespace = "http://my.new.namespace.com/types")]
More details here: https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support
The MSSOAP client fails initializing the soap12 interface of the Hello Example project.
var soap = new ActiveXObject('MSSOAP.SOAPClient30');
soap.mssoapinit('http://<server>/ServiceStack.Hello/soap12');
var retval = soap.Hello('test');
The following error is returned:
WSDLPort: WSDLPort:The soap:binding subnode on the binding for port WSHttpBinding_ISyncReply is missing HRESULT=0x1: Incorrect function.
- WSDLService:Processing service SyncReply found no port definitions HRESULT=0x80070057: The parameter is incorrect.
- WSDLReader:Analyzing the WSDL file failed HRESULT=0x80070057: The parameter is incorrect.
- Client:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect.
I am using ServiceStack version 3.95 with IIS 6.0 and.NET 4.0.30319.
This is the WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="Soap12"
targetNamespace="http://schemas.servicestack.net/types"
xmlns:svc="http://schemas.servicestack.net/types"
xmlns:tns="http://schemas.servicestack.net/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsdl:types>
<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
<xs:schema xmlns:tns="http://schemas.servicestack.net/types" elementFormDefault="qualified" targetNamespace="http://schemas.servicestack.net/types" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Hello">
<xs:sequence>
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="Hello" nillable="true" type="tns:Hello" />
<xs:complexType name="HelloResponse">
<xs:sequence>
<xs:element minOccurs="0" name="Result" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="HelloResponse" nillable="true" type="tns:HelloResponse" />
</xs:schema>
</wsdl:types>
<wsdl:message name="HelloIn">
<wsdl:part name="parameters" element="tns:Hello" />
</wsdl:message>
<wsdl:message name="HelloOut">
<wsdl:part name="parameters" element="tns:HelloResponse" />
</wsdl:message>
<wsdl:portType name="ISyncReply">
<wsdl:operation name="Hello">
<wsdl:input message="svc:HelloIn" />
<wsdl:output message="svc:HelloOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="IOneWay">
</wsdl:portType>
<wsdl:binding name="WSHttpBinding_ISyncReply" type="svc:ISyncReply">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Hello">
<soap:operation soapAction="http://schemas.servicestack.net/types/Hello" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WSHttpBinding_IOneWay" type="svc:IOneWay">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
</wsdl:binding>
<wsdl:service name="SyncReply">
<wsdl:port name="WSHttpBinding_ISyncReply" binding="svc:WSHttpBinding_ISyncReply">
<soap:address location="http://<servername>/servicestack/soap12" />
</wsdl:port>
</wsdl:service>
<wsdl:service name="AsyncOneWay">
<wsdl:port name="WSHttpBinding_IOneWay" binding="svc:WSHttpBinding_IOneWay">
<soap:address location="http://<servername>/servicestack/soap12" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
So I am using a legacy WSDL,and I want to generate some Java code from it to get a better idea of what exactly the web service does as I find Java code to be easier to read than a WSDL. However, using the Apache CFX source generator plug in using the below WSDL file is giving me the following error (same one in soapUI):
Encountered illegal extension attribute "soapAction". Extension attributes must be in a namespace other than WSDL's.
So basically, I want to change the WSDL so that it still properly describes the web service, but can actually be utilized by the plug in. Any suggestions would be most appreciated. I included the whole WSDL because I did not know what parts could be relevant, so apologies for the huge wall of text.
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:tns="http://api.voiceforge.com/SOAPI"
targetNamespace="http://api.voiceforge.com/SOAPI"
xmlns:impl="http://api.voiceforge.com/SOAPI"
xmlns:intf="http://api.voiceforge.com/SOAPI"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Types -->
<wsdl:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://api.voiceforge.com/SOAPI">
<!-- Say -->
<xsd:complexType name="ComplexTextInfo">
<xsd:sequence>
<xsd:element name="SynthString" type="xsd:string" />
<xsd:element minOccurs="0" maxOccurs="1" name="Encoding" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ComplexVoiceInfo">
<xsd:all>
<xsd:element name="Owner" type="xsd:string" />
<xsd:element name="Name" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ComplexAudioInfo">
<xsd:all>
<xsd:element name="DeliveryType" type="xsd:string" />
<xsd:element name="Format" type="xsd:string" />
<xsd:element name="SignalRate" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ComplexAudioData">
<xsd:all>
<xsd:element name="DeliveryType" type="xsd:string" />
<xsd:element name="Format" type="xsd:string" />
<xsd:element name="Data" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<!-- CreateAccount -->
<xsd:complexType name="ComplexCreateUserInfo">
<xsd:all>
<xsd:element name="UserID" type="xsd:string" />
<xsd:element name="Password" type="xsd:string" />
<xsd:element name="DOB" type="xsd:string" />
<xsd:element name="Email" type="xsd:string" />
<xsd:element name="ZipCode" type="xsd:string" />
<xsd:element name="Gender" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<!-- Voice Search -->
<xsd:complexType name="ComplexQuery">
<xsd:all>
<xsd:element name="Owner" type="xsd:string" />
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Age" type="xsd:string" />
<xsd:element name="Gender" type="xsd:string" />
<xsd:element name="Language" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ComplexQueryResult">
<xsd:all>
<xsd:element name="Owner" type="xsd:string" />
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="Age" type="xsd:string" />
<xsd:element name="Gender" type="xsd:string" />
<xsd:element name="Language" type="xsd:string" />
<xsd:element name="Dialect" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="ComplexQueryResultArray">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Voice" nillable="true" type="tns:ComplexQueryResult"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<!-- Messages -->
<wsdl:message name="GetSessionIDSoapIN">
<wsdl:part name="ApplicationID" type="xsd:string" />
<wsdl:part name="UserID" type="xsd:string" />
</wsdl:message>
<wsdl:message name="GetSessionIDSoapOUT">
<wsdl:part name="SessionID" type="xsd:string" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<wsdl:message name="SaySoapIN">
<wsdl:part name="SessionID" type="xsd:string" />
<wsdl:part name="Text" type="tns:ComplexTextInfo" />
<wsdl:part name="VoiceInfo" type="tns:ComplexVoiceInfo" />
<wsdl:part name="AudioInfo" type="tns:ComplexAudioInfo" />
</wsdl:message>
<wsdl:message name="SaySoapOUT">
<wsdl:part name="Audio" type="tns:ComplexAudioData" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<wsdl:message name="CreateAccountSoapIN">
<wsdl:part name="ApplicationID" type="xsd:string" />
<wsdl:part name="UserInfo" type="tns:ComplexCreateUserInfo" />
</wsdl:message>
<wsdl:message name="CreateAccountSoapOUT">
<wsdl:part name="UserID" type="xsd:string" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<wsdl:message name="VoiceSearchSoapIN">
<wsdl:part name="SessionID" type="xsd:string" />
<wsdl:part name="Query" type="tns:ComplexQuery" />
</wsdl:message>
<wsdl:message name="VoiceSearchSoapOUT">
<wsdl:part name="VoiceList" type="tns:ComplexQueryResultArray" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<wsdl:message name="GetAccountInfoSoapIN">
<wsdl:part name="ApplicationID" type="xsd:string" />
<wsdl:part name="UserID" type="xsd:string" />
</wsdl:message>
<wsdl:message name="GetAccountInfoSoapOUT">
<wsdl:part name="SynthesesRemaining" type="xsd:int" />
<wsdl:part name="DefaultVoiceInfo" type="tns:ComplexVoiceInfo" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<wsdl:message name="UpdateAccountInfoSoapIN">
<wsdl:part name="ApplicationID" type="xsd:string" />
<wsdl:part name="UserID" type="xsd:string" />
<wsdl:part name="DefaultVoiceInfo" type="tns:ComplexVoiceInfo" />
<wsdl:part name="ModifySynthesisAmount" type="xsd:int" />
</wsdl:message>
<wsdl:message name="UpdateAccountInfoSoapOUT">
<wsdl:part name="SynthesesRemaining" type="xsd:int" />
<wsdl:part name="DefaultVoiceInfo" type="tns:ComplexVoiceInfo" />
<wsdl:part name="Error" type="xsd:string" />
</wsdl:message>
<!-- Port Types -->
<wsdl:portType name="VF-HTTPS-Binding">
<wsdl:operation name="GetSessionID">
<wsdl:input message="tns:GetSessionIDSoapIN" />
<wsdl:output message="tns:GetSessionIDSoapOUT" />
</wsdl:operation>
<wsdl:operation name="CreateAccount">
<wsdl:input message="tns:CreateAccountSoapIN" />
<wsdl:output message="tns:CreateAccountSoapOUT" />
</wsdl:operation>
<wsdl:operation name="GetAccountInfo">
<wsdl:input message="tns:GetAccountInfoSoapIN" />
<wsdl:output message="tns:GetAccountInfoSoapOUT" />
</wsdl:operation>
<wsdl:operation name="UpdateAccountInfo">
<wsdl:input message="tns:UpdateAccountInfoSoapIN" />
<wsdl:output message="tns:UpdateAccountInfoSoapOUT" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="VF-HTTP-Binding">
<wsdl:operation name="VoiceSearch">
<wsdl:input message="tns:VoiceSearchSoapIN" />
<wsdl:output message="tns:VoiceSearchSoapOUT" />
</wsdl:operation>
<wsdl:operation name="Say">
<wsdl:input message="tns:SaySoapIN" />
<wsdl:output message="tns:SaySoapOUT" />
</wsdl:operation>
</wsdl:portType>
<!-- Bindings -->
<wsdl:binding name="VF-HTTPS-Binding" type="tns:VF-HTTPS-Binding">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="GetSessionID" soapAction="http://api.voiceforge.com/SOAPI#GetSessionID">
<soap:operation soapAction="https://api.voiceforge.com/SOAPI#GetSessionID" RequestNamespace="https://api.voiceforge.com/SOAPI" ResponseNamespace="https://api.voiceforge.com/SOAPI" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CreateAccount">
<soap:operation soapAction="https://api.voiceforge.com/SOAPI#CreateAccount" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetAccountInfo">
<soap:operation soapAction="https://api.voiceforge.com/SOAPI#GetAccountInfo" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="UpdateAccountInfo">
<soap:operation soapAction="https://api.voiceforge.com/SOAPI#UpdateAccountInfo" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="https://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="VF-HTTP-Binding" type="tns:VF-HTTP-Binding">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="VoiceSearch">
<soap:operation soapAction="http://api.voiceforge.com/SOAPI#VoiceSearch" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="http://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Say">
<soap:operation soapAction="http://api.voiceforge.com/SOAPI#Say" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" />
<wsdl:input>
<soap:body use="literal" namespace="http://api.voiceforge.com/SOAPI"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://api.voiceforge.com/SOAPI"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- Services -->
<wsdl:service name="VoiceForgeAPI-S">
<wsdl:port name="VF-HTTPS" binding="tns:VF-HTTPS-Binding">
<wsdl:documentation>VoiceForge HTTPS Service</wsdl:documentation>
<soap:address location="https://api.voiceforge.com/soapi.pl" />
</wsdl:port>
</wsdl:service>
<wsdl:service name="VoiceForgeAPI-I">
<wsdl:port name="VF-HTTP" binding="tns:VF-HTTP-Binding">
<wsdl:documentation>VoiceForge HTTP Service</wsdl:documentation>
<soap:address location="http://api.voiceforge.com/soapi.pl" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Edit with C# code generator:
//---------------------------------------------------------------
wsdl2 -out:VoiceForgeAPI.cs wsdl/soapi.wsdl
Web Services Description Language Utility
Mono Framework v2.0.50727.1433
There where some warnings while generating the code:
wsdl/soapi.wsdl
- This web reference does not conform to WS-I Basic Profile v1.1
R2209: A wsdl:binding in a DESCRIPTION SHOULD bind every wsdl:part of a
wsdl:message in the wsdl:portType to which it refers to one of
soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault
* Binding 'VF-HTTPS-Binding', in Service Description
'http://api.voiceforge.com/SOAPI'
* Binding 'VF-HTTP-Binding', in Service Description
'http://api.voiceforge.com/SOAPI'
- WARNING: At least one operation is of an unsupported type and has been
ignored
Writing file 'VoiceForgeAPI.cs'
//---------------------------------------------------------------
And resulting file, instead of methods having just commented errors like this:
//---------------------------------------------------------------
// WARNING: Could not generate operation binding GetSessionID. The combination of style=rpc with use=literal is not supported
// WARNING: Could not generate operation binding CreateAccount. The combination of style=rpc with use=literal is not supported
// WARNING: Could not generate operation binding GetAccountInfo. The combination of style=rpc with use=literal is not supported
// WARNING: Could not generate operation binding UpdateAccountInfo. The combination of style=rpc with use=literal is not supported
// WARNING: Could not generate operation binding VoiceSearch. The combination of style=rpc with use=literal is not supported
// WARNING: Could not generate operation binding Say. The combination of style=rpc with use=literal is not supported
//---------------------------------------------------------------
I can see this WSDL has been created in the very dark ages of WebServices programming...
Anyway, to be able to execute:
wsdl2java.bat -all your.wsdl
you need to remove soapAction="http://api.voiceforge.com/SOAPI#GetSessionID" in line 207. Change:
<wsdl:operation name="GetSessionID" soapAction="http://api.voiceforge.com/SOAPI#GetSessionID">
to
<wsdl:operation name="GetSessionID">
because specification of soapAction has to be placed in soap:operation extension (WSDL's Soap 1.1 Binding) element.
Issuing wsdl2java -all command gives me these files:
ComplexAudioData.java
ComplexAudioInfo.java
ComplexCreateUserInfo.java
ComplexQuery.java
ComplexQueryResult.java
ComplexQueryResultArray.java
ComplexTextInfo.java
ComplexVoiceInfo.java
ObjectFactory.java
package-info.java
VFHTTPBinding.java
VFHTTPBindingImpl.java
VFHTTPBinding_VFHTTP_Client.java
VFHTTPBinding_VFHTTP_Server.java
VFHTTPSBinding.java
VFHTTPSBindingImpl.java
VFHTTPSBinding_VFHTTPS_Client.java
VFHTTPSBinding_VFHTTPS_Server.java
VoiceForgeAPII.java
VoiceForgeAPIS.java
in com.voiceforge.api.soapi package.
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SearchHotelsResponse xmlns="http://tourico.com/webservices/">
<SearchHotelsResult>
<xs:schema id="TWS_HotelList" targetNamespace="http://tourico.com/webservices/TWS_HotelList.xsd" xmlns:mstns="http://tourico.com/webservices/TWS_HotelList.xsd" xmlns="http://tourico.com/webservices/TWS_HotelList.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="TWS_HotelList" msdata:IsDataSet="true" msdata:Locale="en-US" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Hotel">
<xs:complexType>
<xs:sequence>
<xs:element name="RoomType" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Avail" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="offset" form="unqualified" type="xs:byte" use="required" />
<xs:attribute name="status" form="unqualified" type="xs:boolean" use="required" /></xs:complexType>
</xs:element>
<xs:element name="Discount" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="type" form="unqualified" msprop:Generator_UserColumnName="type" msprop:Generator_ColumnVarNameInTable="columtype" type="xs:string" use="required" />
<xs:attribute name="name" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="from" form="unqualified" msdata:DateTimeMode="Unspecified" type="xs:dateTime" use="required" />
<xs:attribute name="to" form="unqualified" msdata:DateTimeMode="Unspecified" type="xs:dateTime" use="required" />
<xs:attribute name="value" form="unqualified" type="xs:string" use="required" /></xs:complexType>
</xs:element>
<xs:element name="Occup" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Supp" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="supId" form="unqualified" type="xs:int" />
<xs:attribute name="name" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="price" form="unqualified" type="xs:double" use="required" /></xs:complexType>
</xs:element>
<xs:element name="Board" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="bbId" form="unqualified" type="xs:int" />
<xs:attribute name="name" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="price" form="unqualified" type="xs:double" use="required" />
<xs:attribute name="default" form="unqualified" msprop:Generator_UserColumnName="default" msprop:Generator_ColumnVarNameInTable="columndefault" msprop:Generator_ColumnPropNameInTable="defaultColumn"
type="xs:boolean" default="false" /></xs:complexType>
</xs:element>
<xs:element name="Room" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Child" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="age" form="unqualified" type="xs:int" /></xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="seqNum" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="adultNum" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="childNum" form="unqualified" type="xs:int" /></xs:complexType>
</xs:element>
<xs:element name="Price" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="offset" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="value" form="unqualified" type="xs:double" use="required" /></xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="occupId" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="maxAdult" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="maxChild" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="price" form="unqualified" type="xs:double" use="required" />
<xs:attribute name="tax" form="unqualified" type="xs:double" use="required" />
<xs:attribute name="dblBed" form="unqualified" type="xs:boolean" />
<xs:attribute name="avrNightPrice" form="unqualified" type="xs:double" use="required" /></xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="productId" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="name" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="nights" form="unqualified" type="xs:byte" use="required" />
<xs:attribute name="startDate" form="unqualified" type="xs:dateTime" use="required" />
<xs:attribute name="isAvailable" form="unqualified" type="xs:boolean" />
<xs:attribute name="roomId" form="unqualified" type="xs:int" />
<xs:attribute name="hotelRoomTypeId" form="unqualified" type="xs:int" /></xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="hotelId" form="unqualified" type="xs:int" use="required" />
<xs:attribute name="provider" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="name" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="address" form="unqualified" type="xs:string" />
<xs:attribute name="category" form="unqualified" type="xs:string" />
<xs:attribute name="bestVal" form="unqualified" type="xs:byte" />
<xs:attribute name="thumb" form="unqualified" type="xs:string" />
<xs:attribute name="starsLevel" form="unqualified" type="xs:double" />
<xs:attribute name="minAverPrice" form="unqualified" type="xs:double" use="required" />
<xs:attribute name="desc" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="location" form="unqualified" type="xs:string" use="required" />
<xs:attribute name="currency" form="unqualified" type="xs:string" />
<xs:attribute name="brandId" form="unqualified" type="xs:int" />
<xs:attribute name="brandName" form="unqualified" type="xs:string" /></xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<TWS_HotelList xmlns="http://tourico.com/webservices/TWS_HotelList.xsd">
<Hotel hotelId="1041291" provider="localTgsProvider" name="Rush Inn - DEMO - DEMO" address="DEMO - Khalid Bin Waleed Road Dubai 44099" category="Tourist Class" bestVal="0" thumb="http://image1.urlforimages.com/1041291/Rush-Front_Thumbnailed.jpg"
starsLevel="2" minAverPrice="148.54" desc="DEMO - DEMO - Families will love to vacation at the Rush Inn with all the amenities and attractions it provides" location="Bur Dubai,Dubai,AE" currency="AED" brandId="0" brandName="">
<RoomType productId="1041291;1180012;34538" name="Standard" nights="1" startDate="2010-08-20T00:00:00-04:00" isAvailable="true" roomId="3" hotelRoomTypeId="1180012">
<Avail offset="0" status="true" />
<Occup occupId="1041291;1180012;34538;2;2;0;1" maxAdult="4" maxChild="2" price="148.54" tax="0" dblBed="true" avrNightPrice="148.54">
<Board bbId="24" name="Room Only" price="0" default="true" />
<Room seqNum="1" adultNum="1" childNum="1">
<Child age="8" />
</Room>
<Price offset="0" value="148.54" />
</Occup>
<Occup occupId="1041291;1180012;34538;2;2;0;2" maxAdult="4" maxChild="2" price="148.54" tax="0" dblBed="false" avrNightPrice="148.54">
<Board bbId="24" name="Room Only" price="0" default="true" />
<Room seqNum="1" adultNum="1" childNum="1">
<Child age="8" />
</Room>
<Price offset="0" value="148.54" />
</Occup>
</RoomType>
</Hotel>
</TWS_HotelList>
</SearchHotelsResult>
</SearchHotelsResponse>
</soap:Body>
</soap:Envelope>
My bet is the question is when you have a SOAP data which is wrapped in an XML packet which function in PHP can you use to extract SOAP data?
I just researched this for an hour because I had a similar issue. What is boils down to is that just because SOAP is wrapped in XML doesn't mean you can use a "simple" ;-) XML function to extract the SOAP information that you want.
You have to bear namespaces in mind. In my case I had this:
<?xml version="1.0" encoding="utf-8"?>
* <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
* <soap:Body><Request_MerchantStatementResponse xmlns="http://www.netcash.co.za/netserv/ncUpload">
* <Request_MerchantStatementResult>2010/11/06 00:00:00\tOBL\t0\t\tOpening Balance\t100000.00\t+\t0.00\t\t\t\t\t\t\t\r</Request_MerchantStatementResult>
* </Request_MerchantStatementResponse></soap:Body>
* </soap:Envelope>
I needed to extract the "Request_MerchantStatementResult" and only that. The solution was to specify the name spaces referenced in my return XML.
$xml = simplexml_load_string($response);
echo $xml->children('http://schemas.xmlsoap.org/soap/envelope/')
->children('http://www.netcash.co.za/netserv/ncUpload')
->Request_MerchantStatementResponse
->Request_MerchantStatementResult;
The problem comes in if you just print_r the result from simplexml_load_string you get nothing. So be sure to specify your name space.
EDIT
I digress, instead of having
echo $xml->children('http://schemas.xmlsoap.org/soap/envelope/')
->children('http://www.netcash.co.za/netserv/ncUpload')
->Request_MerchantStatementResponse
->Request_MerchantStatementResult;
I should have had:
$result = $xml->children('http://schemas.xmlsoap.org/soap/envelope/')
->children('http://www.netcash.co.za/netserv/ncUpload')
->Request_MerchantStatementResponse;
echo $result->Request_MerchantStatementResult;