OSB 12C REST adapter has blank fields - wsdl

I am invoking a business service from OSB 12C that accepts POST methods. I added a REST adapter in the business column after making the request and response XSD's. In the pipeline, I use an XQuery file for transformation of the proxy service's request body to the business service's body.
Examining the receiving app as well as the network traffic, I see that the request is being submitted with a Content-Type: application/x-www-form-urlencoded header, but the payload is completely blank.
As a test, I changed the method to GET. This places the form fields within the URL, so the transformation, etc. is correct. It just doesn't work in the POST method. I've been stuck for a week on this.
Here's the XSD for the business request:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
targetNamespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
elementFormDefault="qualified" attributeFormDefault="unqualified" nxsd:encoding="US-ASCII">
<xsd:element name="GetPendingRequests-BusinessRequest-Root-Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="db" type="xsd:string"/>
<xsd:element name="fromDate" type="xsd:string"/>
<xsd:element name="max" type="xsd:integer"/>
<xsd:element name="page" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:annotation>
<xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
<xsd:appinfo>USEHEADER=false</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
And the XQuery file:
xquery version "1.0" encoding "utf-8";
(:: OracleAnnotationVersion "1.0" ::)
declare namespace smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request";
(:: import schema at "GetPendingRequestsBusinessRequest.xsd" ::)
declare variable $db as xs:string external;
declare variable $fromDate as xs:string external;
declare variable $max as xs:integer external;
declare variable $page as xs:integer external;
declare function local:func($db as xs:string, $fromDate as xs:string, $max as xs:integer, $page as xs:integer) as element()
(:: schema-element(smar:GetPendingRequests-BusinessRequest-Root-Element) ::) {
<smar:GetPendingRequests-BusinessRequest-Root-Element
xmlns:smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request">
<smar:db>{fn:data($db)}</smar:db>
<smar:fromDate>{fn:data($fromDate)}</smar:fromDate>
<smar:max>{fn:data($max)}</smar:max>
<smar:page>{fn:data($page)}</smar:page>
</smar:GetPendingRequests-BusinessRequest-Root-Element>
};
local:func($db, $fromDate, $max, $page)
The WADL file:
<?xml version = '1.0' encoding = 'UTF-8'?>
<application xmlns:soa="http://www.oracle.com/soa/rest"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
xmlns="http://wadl.dev.java.net/2009/02">
<doc title="SmartCardBusinessServices">WADL Reference for REST calls for smart cards</doc>
<grammars>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
</xsd:schema>
</grammars>
<resources>
<resource path="/getPendingRequests">
<method name="POST" soa:wsdlOperation="GetPendingRequests">
<request>
<representation mediaType="application/x-www-form-urlencoded"
element="cns:GetPendingRequests-BusinessRequest-Root-Element"
xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"/>
</request>
<response status="200">
<representation mediaType="application/json"
element="cns:GetPendingRequests-BusinessResponse-Root-Element"
xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"/>
</response>
</method>
</resource>
</resources>
</application>
Lastly, the WSDL:
<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions
name="SmartCardBusinessServices"
targetNamespace="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
xmlns:tns="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
xmlns:inp1="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
xmlns:inp2="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<plnk:partnerLinkType name="SmartCardBusinessServices">
<plnk:role name="SmartCardBusinessServicesProvider" portType="tns:SmartCardBusinessServices_ptt"/>
</plnk:partnerLinkType>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetPendingRequests_inputMessage">
<wsdl:part name="request" element="inp1:GetPendingRequests-BusinessRequest-Root-Element"/>
</wsdl:message>
<wsdl:message name="GetPendingRequests_outputMessage">
<wsdl:part name="reply" element="inp2:GetPendingRequests-BusinessResponse-Root-Element"/>
</wsdl:message>
<wsdl:portType name="SmartCardBusinessServices_ptt">
<wsdl:operation name="GetPendingRequests">
<wsdl:input message="tns:GetPendingRequests_inputMessage"/>
<wsdl:output message="tns:GetPendingRequests_outputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SmartCardBusinessServices_ptt-binding" type="tns:SmartCardBusinessServices_ptt">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetPendingRequests">
<soap:operation soapAction="GetPendingRequests"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>

Related

Error importing a WSDL in SoapUI

I'm getting this message when attempting to create a new SoapUI project and import a WSDL for Web Service Simulation. The error message seems incomplete as it does not actually say what tag is not being closed.
Error loading [file:\C:\chad.wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: does not close tag
Here's the WSDL:
<wsdl:definitions name="Chad" targetNamespace="http://www.examples.com/wsdl/Chad.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/Chad.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="SayHiRequest">
<wsdl:part name="text" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="SayHiResponse">
<wsdl:part name="text" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="Hello_PortType">
<wsdl:operation name="sayHi">
<wsdl:input message="tns:SayHiRequest"/>
<wsdl:output message="tns:SayHiResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHi">
<soap:operation soapAction="sayHi"/>
<wsdl:input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
</wsdl:input>
<wsdl:output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Hello_Service">
<wsdl:documentation>WSDL File for HelloService</documentation>
<wsdl:port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address location="http://www.examples.com/chad/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
My WSDL seems to validate.
I've found some similar issues online where the wsdl is imported from an http url and the import results in this same error, but i'm importing straight from my C drive (not over http) so the suggested solutions have not worked.
There was a namespace issue in the following line
Original line
<wsdl:documentation>WSDL File for HelloService</documentation>
Changed to
<wsdl:documentation>WSDL File for HelloService</wsdl:documentation>
Here is the updated wsdl
<?xml version='1.0' encoding="UTF-8"?>
<wsdl:definitions name="Chad" targetNamespace="http://www.examples.com/wsdl/Chad.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/Chad.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="SayHiRequest">
<wsdl:part name="text" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="SayHiResponse">
<wsdl:part name="text" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="Hello_PortType">
<wsdl:operation name="sayHi">
<wsdl:input message="tns:SayHiRequest"/>
<wsdl:output message="tns:SayHiResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHi">
<soap:operation soapAction="sayHi"/>
<wsdl:input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
</wsdl:input>
<wsdl:output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:chadservice" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Hello_Service">
<wsdl:documentation>WSDL File for HelloService</wsdl:documentation>
<wsdl:port binding="tns:Hello_Binding" name="Hello_Port">
<soap:address location="http://www.examples.com/chad/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I was able to load the WSDL in soapUI 4.5.2 without getting the error you got. Although, I did get the below error.
Tue Aug 20 11:30:21 ADT 2013:ERROR:Could not find element [{https://something.com/service/types}IsAvailableRequest] specified in part [parameters]
I had the same error but a different cause:
Instead of:
https://sitename.com/prefix/app/services.asxm
Use:
https://sitename.com/prefix/app/services.asxm?WSDL
I hadn't used SOAP before and it wasn't immediately obvious that I was missing the ?WSDL from the url. Posting just in case anyone else has the same issue.

Converting an old JAX RPC WSDL file to a JAX WS WSDL file

I was wondering if is there some way to convert an old RPC WSDL file to a JAX-WS WSDL file. Tried my best to make sure I did my homework but I'm kind of lost here.
From what I've read, I should remove all the 'encodingstyle' ocurrences and switch use="encoded" to use="literal". I can't run any tests by now since the service is currently unavailable. Does anyone know if that should be enough? Any insight will be extremely appreciated.
This is my WSDL file:
<?xml version="1.0" encoding="iso-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wsScrc.XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wsScrc.XML">
<types>
<xsd:schema targetNamespace="urn:wsScrc.XML">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="XMLRequest">
<part name="parmA" type="xsd:string" />
<part name="parmB" type="xsd:string" />
<part name="parmC" type="xsd:string" />
<part name="parmD" type="xsd:string" />
<part name="parmE" type="xsd:string" />
<part name="parmF" type="xsd:string" />
<part name="parmG" type="xsd:string" />
</message>
<message name="XMLResponse">
<part name="respA" type="xsd:string" />
<part name="respB" type="xsd:string" />
<part name="respC" type="xsd:string" />
<part name="respD" type="xsd:string" />
<part name="respE" type="xsd:string" />
</message>
<message name="monitorRequest"></message>
<message name="monitorResponse">
<part name="ipServidor" type="xsd:string" />
</message>
<portType name="wsScrc.XMLPortType">
<operation name="XML">
<documentation>Retorna o xml</documentation>
<input message="tns:XMLRequest"/>
<output message="tns:XMLResponse"/>
</operation>
<operation name="monitor">
<documentation>Retorna uma mensagem de ok</documentation>
<input message="tns:monitorRequest"/>
<output message="tns:monitorResponse"/>
</operation>
</portType>
<binding name="wsScrc.XMLBinding" type="tns:wsScrc.XMLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="XML">
<soap:operation soapAction="urn:wsScrc.XML#XML" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="monitor">
<soap:operation soapAction="urn:wsScrc.monitor#monitor" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="wsScrc.XML">
<port name="wsScrc.XMLPort" binding="tns:wsScrc.XMLBinding">
<soap:address location="http://thisismyaddress/webservicePHP/ws.php"/>
</port>
</service>
</definitions>
Thanks in advance.
We were able to do the same by altering the WSDL in that way.
The only issue is that we had to use SAAJ in order to generate the right request and to process the response.
In another WS we used it was just not possible because the XML in the body is generated by Castor. Finally we did not succeed as we did not know what the server expect.
In conclusion I would say: it depends how the server was implemented.

WSDL with soap-rpc-style does not compile

I'm using this wsdl-file to describe my webservice:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://www.myapproach.de/knowledgebase" name="Knowledgebase"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://www.myapproach.de/knowledgebase"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:rq="http://www.myapproach.de/knowledgebase">
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://www.myapproach.de/knowledgebase" schemaLocation="GetValueRequest.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
<wsdl:message name="getValueForKeyResponse">
<wsdl:part name="parameters" element="rq:getValueForKeyResponse" />
</wsdl:message>
<wsdl:portType name="KnowledgebasePortType">
<wsdl:operation name="getValueForKey">
<wsdl:input message="tns:getValueForKey" />
<wsdl:output message="tns:getValueForKeyResponse" />
</wsdl:operation>
</wsdl:portType>
<wsp:Policy wsu:Id="KnowledgebasePortBinding_WSAM_Addressing_Policy">
<wsam:Addressing wsp:Optional="true">
<wsp:Policy />
</wsam:Addressing>
</wsp:Policy>
<wsdl:binding name="KnowledgebasePortBinding" type="tns:KnowledgebasePortType">
<wsaw:UsingAddressing />
<wsp:PolicyReference URI="#KnowledgebasePortBinding_WSAM_Addressing_Policy" />
<!-- http://www.w3.org/2003/05/soap/bindings/HTTP/ -->
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="getValueForKey">
<soap:operation soapAction="http://www.myapproach.de/knowledgebase/getValueForKey" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Knowledgebase">
<wsdl:port name="KnowledgebasePortType" binding="tns:KnowledgebasePortBinding">
<soap:address location="http://www.myapproach.de/knowledgebase" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
GetValueRequest.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.myapproach.de/knowledgebase" xmlns:tns="http://www.myapproach.de/knowledgebase">
<xsd:element name="getValueForKey" type="tns:getValueForKey" />
<xsd:complexType name="getValueForKey">
<xsd:sequence>
<xsd:element name="arg0" type="xsd:string" minOccurs="0" />
<xsd:element name="arg1" type="xsd:string" minOccurs="0" />
<xsd:element name="arg2" type="xsd:double"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getValueForKeyResponse" type="tns:getValueForKeyResponse" />
<xsd:complexType name="getValueForKeyResponse">
<xsd:sequence>
<xsd:element name="return" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Everytime I run wsimport, I get this error:
[wsimport] parsing WSDL...
[wsimport] [ERROR] Invalid wsdl:operation "getValueForKey": its a rpc-literal operation, message part must refer to a schema type declaration
[wsimport] line 27 of file:/path/MyFile.wsdl
I have exported the getValueForKey type to the xsd-schemafile, so I don't understand this error... I'm trying this sh*** the whole day grml
Shortly after posting the question I found the answer :-)
Instead of
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
use this
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" type="rq:getValueForKey" />
</wsdl:message>
the attribute "type" must be used instead of "element".
Additionally the soap:body element has to have a namespace
<wsdl:input>
<soap:body use="literal" namespace="YourNormalNamespace" />
</wsdl:input>
In short, wsdl part has to have type in case of RPC style of webservices else it has to be document style.

WSDL Definition Problem

We have been given a .wsdl file (listing below) which we will be using to generate c# code for use in our app. When I load the file into xmlspy I get the following error
attribute 'type' in message part 'organisation' (message 'getOrganisationResponse') refers to type 'organisation' which is not defined within the WSDL file!
It says it can't find the type but this is defined in the section at the top of the file, so I'm not sure why it does not find it.
Any help would be appreciated
Cheers
Richard
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<!-- Organisation object -->
<xsd:element name="organisation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="organisation"/>
</message>
<portType name="xxxxPortType">
<!-- Get organisation function -->
<operation name="getOrganisation">
<input message="tns:getOrganisationRequest"/>
<output message="tns:getOrganisationResponse"/>
</operation>
</portType>
<binding name="xxxxBinding" type="tns:xxxxPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<!-- Get organisation function -->
<operation name="getOrganisation">
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="xxxxService">
<port name="xxxxPort" binding="tns:xxxxBinding">
<soap:address location="http://www.xxxx.com/xxxx/application/soap.php"/>
</port>
</service>
</definitions>
Your type declarations underneath <types> need to be given their own namespace. I'm guessing that the supplier of your wsdl either used an extremely lax parser when testing the WSDL they wrote or relied on some code first WSDL generation tool to create this WSDL. In either case, the onus is on them to get you a properly conforming WSDL and xsd.
Here is an example of what the relevant parts of that WSDL should look like - change the namespaces here as you wish:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns:types="http://www.xxxx.com/types/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<xsd:schema targetNamespace="http://www.xxxx.com/types/"
xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="organisation">
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="types:organisation"/>
</message>
...

WSDL list of complexType HOWTO- define, return from a service?

How do you define a list of complex type items in WSDL?
I have a rather simple WSDL with 2 complex types
<xsd:complexType name="itemProperty">
<xsd:all>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="value" type="xsd:string" />
<xsd:element name="type" type="xsd:string" />
</xsd:all>
</xsd:complexType>
Then i'm trying to make a list of this complexType like this:
<xsd:complexType name="itemPropertyList">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:sequence>
<xsd:element name="item" type="tns:itemProperty"
maxOccurs="unbounded" minOccurs="0" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
I intend to use this list
<message name="getListRequest"></message>
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
<operation name="getList">
<documentation>Returns an array.</documentation>
<input message="tns:getListRequest" />
<output message="tns:getListResponse" />
</operation>
Instead of a list of elements of type itemProperty, I get this reply, no matter what variations i've tryed (including replacing the base item with the explicit string elements)
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getListResponse>
<return SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">name</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ae</value>
</item>
<item>
<key xsi:type="xsd:string">value</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ee</value>
</item>
<item>
<key xsi:type="xsd:string">type</key>
<value xsi:type="xsd:string">name_4c3b38b0b782b</value>
</item>
</item>
</return>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Any ideas? What is this ns2:Map thing? It's been haunting me for over a week!
Solved.
I used the AXIS model for delivering lists. This involved extending the namespaces attributes to include some extra encodings. I don't know which did the trick, I just added as many as possible while resolving conflicts with the help of eclipse's WSDL editor.
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="urn:mynamespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:mynamespace"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ax21="http://example.org/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
Also I added 2 extra attributes to declare qualified-form attributes and elements within the schema
<xsd:schema targetNamespace="urn:mynamespace" attributeFormDefault="qualified" elementFormDefault="qualified">
...
</xsd:schema>
Instead of relying on the ComplexType declaration to make a "nillable" unbounded sequence of a complex type within my schema, I switched to declare an element like this:
<xsd:element name="getListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="tns:itemProperty" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Then, when defining the message part for the operation I used
<message name="getListResponse">
<part name="parameters" element="tns:getListResponse" />
</message>
instead of
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
This resulted in a correct enveloper returned:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:mynamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getListResponse>
<parameters xsi:type="ns1:getListResponse">
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644a8e</name>
<value xsi:type="xsd:string">value4c4417b644aaa</value>
<type xsi:type="xsd:string">type4c4417b644ae8</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644b26</name>
<value xsi:type="xsd:string">value4c4417b644b64</value>
<type xsi:type="xsd:string">type4c4417b644ba1</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644bdf</name>
<value xsi:type="xsd:string">value4c4417b644c1c</value>
<type xsi:type="xsd:string">type4c4417b644c59</type>
</return>
</parameters>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Resources