We are changing our soap webservices from jetty to jaxws. The goal is to keep the same input message. I have used the original WSDL to create the service with netbeans. The WSDL is the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" type="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" type="xs:string"/>
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://www.mycompany.nl/DcxExpeditieService/v1"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
When using this WSDL in soapui it results in the following input example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditieOperation>
<DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</DcxExpeditie>
</v1:DcxExpeditieOperation>
</soapenv:Body>
</soapenv:Envelope>
However, the original input format was:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mycompany.nl/DcxExpeditieService/v1">
<soapenv:Header/>
<soapenv:Body>
<v1:DcxExpeditie>
<v1:Expeditie>
<v1:tag1>?</v1:tag1>
<v1:tag2>?</v1:tag2>
</v1:Expeditie>
</v1:DcxExpeditie>
</soapenv:Body>
</soapenv:Envelope>
so with no DcxExpeditieOperation tag and with the v1 namespace in front of DcxExpeditie
Is this possible and if so, how can I accomplish this?
Try to change SOAP binding from rpc to document to remove DcxExpeditieOperation tag:
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
To fix the namespace issue refer DcxExpeditie element insted of type:
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
Updated WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:tns="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xs:schema targetNamespace="http://www.mycompany.nl/DcxExpeditieService/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DcxExpeditie" type="tns:DcxExpeditie"/>
<xs:element name="DcxExpeditieResponse" type="xs:string"/>
<xs:complexType name="DcxExpeditie">
<xs:sequence>
<xs:element name="Expeditie" type="tns:Expeditie"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Expeditie">
<xs:sequence>
<xs:element name="tag1" type="xs:string"/>
<xs:element name="tag2" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="DcxExpeditieRequest">
<wsdl:part name="DcxExpeditie" element="tns:DcxExpeditie"/>
</wsdl:message>
<wsdl:message name="DcxExpeditieResponse">
<wsdl:part name="DcxExpeditieResponse" element="tns:DcxExpeditieResponse" />
</wsdl:message>
<wsdl:portType name="DcxExpeditieServicePortType">
<wsdl:operation name="DcxExpeditieOperation">
<wsdl:input message="tns:DcxExpeditieRequest"/>
<wsdl:output message="tns:DcxExpeditieResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DcxExpeditieServiceSOAP" type="tns:DcxExpeditieServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DcxExpeditieOperation">
<soap:operation soapAction="http://www.mycompany.nl/DcxExpeditieService/v1/DcxExpeditie"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="DcxExpeditieService">
<wsdl:port name="DcxExpeditieServiceSOAP" binding="tns:DcxExpeditieServiceSOAP">
<soap:address location="https://someserver.mycompany.nl/vbs/dcxexpeditie"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Related
I am using perl soap::lite to build a web services client.
The implementation works fine for simple methods, which will e.g. require a single scalar argument.
EG, the following works fine.
#!/usr/bin/perl
use warnings;
use SOAP::Lite +trace=>debug;
use strict;
use Data::Dumper;
$SOAP::Constants::PREFIX_ENV = 'SOAP-ENV';
my $base="https://XXXX:60001/GDBIncidentWebService/Config?wsdl&style=rpc";
my $user="XXXX";
my $pwd="XXXX";
my $lite = SOAP::Lite -> readable(1)
-> service($base) ;
my #res=$lite->readIncident("123456");
print Dumper(\#res);
exit;
sub SOAP::Transport::HTTP::Client::get_basic_credentials { return $user => $pwd ; }
I need to call one method which requires a more complex set of arguments(a few scalars plus one array of key-value pairs).
I figure I should use the SOAP::Data module to serialize my data correctly but fail to get it to work.
Even the "simple" methods (like the one above) do not seem to work.
EG (just showing lines changed from above script) :
my $arg= SOAP::Data->new()->type('xs:string')-> value("20054106");
my #res=$lite->readIncident($arg);
Yields:
String value expected instead of SOAP::Data reference
Any idea on how to fix this ? Thanks a lot !
For reference here is the wsdl for the method called in my script
<wsdl:operation name="readIncident">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi" parts="ticketID "/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi"/>
</wsdl:output>
</wsdl:operation>
The full WSDL looks like follows - spread into 3 files. Main WSDL file:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="GDBIncidentWebServiceWsd" targetNamespace="urn:GDBIncidentWebServiceWsd" xmlns:bns0="urn:GDBIncidentWebServiceWsd/Config/rpc" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:import location="./bindings/Config_rpc.wsdl" namespace="urn:GDBIncidentWebServiceWsd/Config/rpc"/>
<wsdl:service name="GDBIncidentWebService">
<wsdl:port name="ConfigPort_Rpc" binding="bns0:ConfigBinding">
<soap:address location="http://xxxx/GDBIncidentWebService/Config?style=rpc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Bindings file (extract)
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ns0="urn:com.dbag.gde.gdb.types" targetNamespace="urn:GDBIncidentWebServiceWsd/GDBIncidentWebServiceVi/rpc" xmlns:tns="urn:GDBIncidentWebServiceWsd/GDBIncidentWebServiceVi/rpc" xmlns:ns2="urn:java/lang">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:com.dbag.gde.gdb.types" xmlns:tns="urn:com.dbag.gde.gdb.types" elementFormDefault="qualified">
<xs:complexType name="KeyValuePair">
<xs:sequence>
<xs:element name="key" type="xs:string" nillable="true" minOccurs="0"/>
<xs:element name="value" type="xs:string" nillable="true" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ArrayOfKeyValuePair">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="KeyValuePair" type="tns:KeyValuePair" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:java/lang" xmlns:tns="urn:java/lang" elementFormDefault="qualified">
<xs:complexType name="ArrayOfString">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="String" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="createInsourcingIncidentIn">
<wsdl:part name="externalKey" type="ns1:string"/>
<wsdl:part name="title" type="ns1:string"/>
<wsdl:part name="description" type="ns1:string"/>
<wsdl:part name="impact" type="ns1:string"/>
<wsdl:part name="urgency" type="ns1:string"/>
<wsdl:part name="contact" type="ns1:string"/>
<wsdl:part name="creatorGroup" type="ns1:string"/>
<wsdl:part name="category1" type="ns1:string"/>
<wsdl:part name="category2" type="ns1:string"/>
<wsdl:part name="category3" type="ns1:string"/>
<wsdl:part name="extReference" type="ns0:ArrayOfKeyValuePair"/>
<wsdl:part name="attachments" type="ns0:ArrayOfAttachment"/>
<wsdl:part name="additionalFields" type="ns0:ArrayOfKeyValuePair"/>
<wsdl:part name="assignmentGroup" type="ns1:string"/>
<wsdl:part name="assignmentSubGroup" type="ns1:string"/>
<wsdl:part name="productId" type="ns1:string"/>
<wsdl:part name="productName" type="ns1:string"/>
<wsdl:part name="service" type="ns1:string"/>
<wsdl:part name="customer" type="ns1:string"/>
</wsdl:message>
<wsdl:portType name="GDBIncidentWebServiceVi_Rpc">
<wsdl:operation name="createInsourcingIncident">
<wsdl:input message="tns:createInsourcingIncidentIn"/>
<wsdl:output message="tns:createInsourcingIncidentOut"/>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
Operation definition
<wsdl:operation name="createInsourcingIncident">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi" parts="externalKey title description impact urgency contact creatorGroup category1 category2 category3 extReference attachments additionalFields assignmentGroup assignmentSubGroup productId productName service customer "/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="urn:GDBIncidentWebServiceVi"/>
</wsdl:output>
</wsdl:operation>
Update and resolution.
It looks like using the proxy/uri method to create the SOAP::Lite object (instead of simply referencing the WSDL "service") strings is mandatory if you want to pass complex data
Therefore the code now looks as follows for the simple request :
my $base="https://XXXXX/GDBIncidentWebService/Config?wsdl&style=rpc";
my $uri="urn:GDBIncidentWebServiceVi"
my $ticketID='20054106';
my $lite = SOAP::Lite -> proxy($base)
-> uri($uri);
my $res = $lite -> readIncident(SOAP::Data->('ticketID' => $ticketID))
-> result;
print Dumper($res);
I have created a WSDL and a Mule SOAP proxy web service using the MuleSoft XML Only SOAP Web Service example. My application is working fine except for one issue: When the XSD is stored anywhere other than the root of the project, it will not resolve. I created folders of service and xsd inside /src/main/resources as shown in the example project, however when the service is invoked I receive the following error:
[[bpi.sfdcservices].connector.http.mule.default.receiver.02] org.apache.cxf.wstx_msv_validation.ResolvingGrammarReaderController: C:\Users\mmrg\MuleStudio\workspace\bpi.sfdcservices\xsd\sfdcServicesApiTypes.xsd (The system cannot find the path specified)
java.io.FileNotFoundException: C:\Users\mmrg\MuleStudio\workspace\bpisfdcservices\xsd\sfdcServicesApiTypes.xsd (The system cannot find the path specified)
The xsd is imported as:
<xs:import namespace="BPI/Types" schemaLocation="xsd/sfdcServicesApiTypes.xsd"/>
If I change this location to
<xs:import namespace="BPI/Types" schemaLocation="sfdcServicesApiTypes.xsd"/>
And place the xsd in the root of the project, the service executes normally.
The WSDL is able to be referenced in the class path/relative pathing.
<cxf:proxy-service namespace="BPI/sfdcServices/1.0" service="sfdcServices" payload="body" doc:name="SOAP" port="sfdcServicesHttpSoapEndpoint" wsdlLocation="service/sfdcServices.wsdl" validationEnabled="true"/>
From what I can see my project is set up the same as the Mule example. I do not see any specific mappings etc in their configuration. I'm suspecting there is something off about the way my WSDL/XSD is written since it behaves the same when I imported all of my project files into the example project, but cannot figure out the issue.
sfdcServices.wsdl:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="SFDCServices" targetNamespace="BPI/sfdcServices/1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="BPI/sfdcServices/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:btns="BPI/Types" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" >
<wsdl:documentation>Services for CRU operations in SFDC</wsdl:documentation>
<wsdl:types>
<xs:schema targetNamespace="BPI/sfdcServices/1.0" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="BPI/Types" schemaLocation="xsd/sfdcServicesApiTypes.xsd"/>
<xs:element name="querySFDCSingleRequest" type="btns:querySFDCSingleRequest"/>
<xs:element name="querySFDCSingleResponse" type="btns:querySFDCSingleResponse"/>
<xs:element name="updateSFDCSingleRequest" type="btns:updateSFDCSingleRequest"/>
<xs:element name="updateSFDCSingleResponse" type="btns:updateSFDCSingleResponse"/>
<xs:element name="createSFDCSingleRequest" type="btns:createSFDCSingleRequest"/>
<xs:element name="createSFDCSingleResponse" type="btns:createSFDCSingleResponse"/>
</xs:schema>
</wsdl:types>
<wsdl:documentation>Query for a single sObject</wsdl:documentation>
<wsdl:message name="querySFDCSingleRequestMsg">
<wsdl:part name="querySFDCSingleRequestPart" element="tns:querySFDCSingleRequest"/>
</wsdl:message>
<wsdl:message name="querySFDCSingleResponseMsg">
<wsdl:part name="querySFDCSingleResponsePart" element="tns:querySFDCSingleResponse"/>
</wsdl:message>
<wsdl:documentation>Update a single sObject</wsdl:documentation>
<wsdl:message name="updateSFDCSingleRequestMsg">
<wsdl:part name="updateSFDCSingleRequestPart" element="tns:updateSFDCSingleRequest"/>
</wsdl:message>
<wsdl:message name="updateSFDCSingleResponseMsg">
<wsdl:part name="updateSFDCSingleResponsePart" element="tns:updateSFDCSingleResponse"/>
</wsdl:message>
<wsdl:documentation>Create a single sObject</wsdl:documentation>
<wsdl:message name="createSFDCSingleRequestMsg">
<wsdl:part name="createSFDCSingleRequestPart" element="tns:createSFDCSingleRequest"/>
</wsdl:message>
<wsdl:message name="createSFDCSingleResponseMsg">
<wsdl:part name="createSFDCSingleResponsePart" element="tns:createSFDCSingleResponse"/>
</wsdl:message>
<wsdl:portType name="sfdcServicesSOAP">
<wsdl:operation name="querySFDCSingle">
<wsdl:input name="querySFDCSingleRequestInput" message="tns:querySFDCSingleRequestMsg"/>
<wsdl:output name="querySFDCSingleResponseOutput" message="tns:querySFDCSingleResponseMsg"/>
</wsdl:operation>
<wsdl:operation name="updateSFDCSingle">
<wsdl:input name="updateSFDCSingleRequestInput" message="tns:updateSFDCSingleRequestMsg"/>
<wsdl:output name="updateSFDCSingleResponseOutput" message="tns:updateSFDCSingleResponseMsg"/>
</wsdl:operation>
<wsdl:operation name="createSFDCSingle">
<wsdl:input name="createSFDCSingleRequestInput" message="tns:createSFDCSingleRequestMsg"/>
<wsdl:output name="createSFDCSingleResponseOutput" message="tns:createSFDCSingleResponseMsg"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="sfdcServicesSoapBinding" type="tns:sfdcServicesSOAP">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="querySFDCSingle">
<soap:operation soapAction="querySFDCSingle" style="document"/>
<wsdl:input name="querySFDCSingleRequestInput">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="querySFDCSingleResponseOutput">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateSFDCSingle">
<soap:operation soapAction="updateSFDCSingle" style="document"/>
<wsdl:input name="updateSFDCSingleRequestInput">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="updateSFDCSingleResponseOutput">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="createSFDCSingle">
<soap:operation soapAction="createSFDCSingle" style="document"/>
<wsdl:input name="createSFDCSingleRequestInput">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="createSFDCSingleResponseOutput">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="sfdcServices">
<wsdl:port name="sfdcServicesHttpSoapEndpoint" binding="tns:sfdcServicesSoapBinding">
<soap:address location="http://localhost:8084/BPI/services/sfdcServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
sfdcServicesApiTypes.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="BPI/Types" targetNamespace="BPI/Types" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:complexType name="querySFDCSingleRequest">
<xs:sequence>
<xs:element name="sObjectType" type="xs:string" nillable="false"/>
<xs:element name="queryFilterField" type="xs:string" nillable="false" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="queryCondition" type="ns1:queryCondition" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="querySFDCSingleResponse">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="updateSFDCSingleRequest">
<xs:sequence>
<xs:element name="sObjectType" type="xs:string" nillable="false"/>
<xs:element name="Id" type="xs:string" nillable="false"/>
<xs:element name="fieldUpdates" type="ns1:dataPair" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="updateSFDCSingleResponse">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="createSFDCSingleRequest">
<xs:sequence>
<xs:element name="sObjectType" type="xs:string" nillable="false"/>
<xs:element name="fieldUpdates" type="ns1:dataPair" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="createSFDCSingleResponse">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="dataPair">
<xs:sequence>
<xs:element name="fieldName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="value" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="queryCondition">
<xs:sequence>
<xs:element name="queryField" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="operator" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="value" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I am new to web services, I bought a book and started to learn from it, the WSDL is :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ttdev.com/ss" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SimpleService" targetNamespace="http://ttdev.com/ss">
<wsdl:types>
<xsd:schema targetNamespace="http://ttdev.com/ss">
<xsd:element name="concatRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="s1" type="xsd:string" />
<xsd:element name="s2" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="concatResponse" type="xsd:string">
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="concatRequest">
<wsdl:part element="tns:concatRequest" name="parameters"/>
</wsdl:message>
<wsdl:message name="concatResponse">
<wsdl:part element="tns:concatResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="SimpleService">
<wsdl:operation name="concat">
<wsdl:input message="tns:concatRequest"/>
<wsdl:output message="tns:concatResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SimpleServiceSOAP" type="tns:SimpleService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="concat">
<soap:operation soapAction="http://ttdev.com/ss/NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SimpleService">
<wsdl:port binding="tns:SimpleServiceSOAP" name="p1">
<soap:address location="http://localhost:8080/ss/p1"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I run the SimpleService_P1_Server, it s working, but when I run the client :
SimpleService_P1_Client I got this exeption :
Apr 8, 2012 9:51:47 AM com.ttdev.ss.SimpleService_Service <clinit>
INFO: Can not initialize the default wsdl from src/main/resources/SimpleService.wsdl
Exception in thread "main" javax.xml.ws.WebServiceException: Port {http://ttdev.com/ss}p1 not found.
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:328)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
at javax.xml.ws.Service.getPort(Unknown Source)
at com.ttdev.ss.SimpleService_Service.getP1(SimpleService_Service.java:56)
at com.ttdev.ss.SimpleService_P1_Client.main(SimpleService_P1_Client.java:49)
Thanks, your help is appreciated.
I also faced similar issue some time back. You may want to use a prefix "file:" before "src/main/resources". Here is the resultant code:
WSDLToJava.main(new String[] { "-client", "-d", "src/main/java",
"file:src/main/resources/SimpleService.wsdl" });
I've been experiencing some issues with the header presentation of a SOAP Request. I think I'm missing something.
My (partial) wsdl looks like this:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:aws="http://xml.xxx.com"
xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A"
xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
targetNamespace="http://xml.xxx.com">
<wsdl:types>
<xsd:schema targetNamespace="http://xml.xxx.com">
<xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
<xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
<wsdl:part name="Session" element="ns0:Session"/>
</wsdl:message>
<wsdl:message name="Security_Authenticate_6_1">
<wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
</wsdl:message>
<wsdl:message name="Security_AuthenticateReply_6_1">
<wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
</wsdl:message>
<wsdl:portType name="XXXWebServicesPT">
<wsdl:operation name="Security_Authenticate">
<wsdl:input message="aws:Security_Authenticate_6_1"/>
<wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Security_Authenticate">
<soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
<wsdl:input>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="aws:Session" part="Session" use="literal"/>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XXXWebServices">
<wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
<soap:address location="https://test.webservices.xxx.com"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I want to access the Security_Authenticate action, in which case, the header must look something like:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
<soapenv:Body>
<vls:Security_Authenticate>
<vls:tagX>
<vls:tagY>yyy</vls:tagY>
<vls:tagZ>Z</vls:tagZ>
</vls:tagX>
</vls:Security_Authenticate>
</soapenv:Body>
</soapenv:Envelope>
How should I built my soapenvelope and my header namespaces?
Thanks.
You have to declare the namespace before you use the object in the xsd, so in your case, to use the Session object:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>
<soapenv:Header>
<wbs:Session xmlns:wbs='http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd'>
<wbs:SessionId></wbs:SessionId>
<wbs:SequenceNumber></wbs:SequenceNumber>
<wbs:SecurityToken></wbs:SecurityToken>
</wbs:Session>
</soapenv:Header>
...
I am writing a web service starting with writing the WSDL. I have been generating server-side skeleton code using wsimport and then writing my own implementing class. I'm running the web service on an Axis2 server. When using soapUI, the SOAP messages coming to and from the service look fine, but when using a web service client, I'm getting null in the client-side stubs. I've heard that this could be a namespace issue, but I see anything wrong. Here is my copy of the WSDL. Any help would be appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://test.sa.lmco.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://test.sa.lmco.com">
<!-- **************** -->
<!-- ** Types ** -->
<!-- **************** -->
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://test.sa.lmco.com">
<xs:element name="sayHello">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="s" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sayHelloResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getTaxonomyNode">
<xs:complexType>
<xs:sequence>
<xs:element name="taxonomyId" minOccurs="1" maxOccurs="1" type="xs:int" />
<xs:element name="nodeId" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getTaxonomyNodeResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="resultNode" type="ns:TaxonomyNode" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getChildren">
<xs:complexType>
<xs:sequence>
<xs:element name="taxonomyId" minOccurs="1" maxOccurs="1" type="xs:int" />
<xs:element name="parentNodeId" minOccurs="1" maxOccurs="1" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getChildrenResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="childNodes" minOccurs="0" maxOccurs="unbounded" type="ns:TaxonomyNode" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="TaxonomyNode">
<xs:sequence>
<xs:element name="taxonomyId" type="xs:int" />
<xs:element name="nodeId" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="LCD">
<xs:sequence>
<xs:element name="language" type="xs:string" />
<xs:element name="content" type="xs:string" />
<xs:element name="description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<!-- ***************** -->
<!-- ** Messages ** -->
<!-- ***************** -->
<wsdl:message name="sayHelloRequest">
<wsdl:part name="parameters" element="ns:sayHello"/>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part name="parameters" element="ns:sayHelloResponse"/>
</wsdl:message>
<wsdl:message name="getTaxonomyNodeRequest">
<wsdl:part name="parameters" element="ns:getTaxonomyNode" />
</wsdl:message>
<wsdl:message name="getTaxonomyNodeResponse">
<wsdl:part name="parameters" element="ns:getTaxonomyNodeResponse" />
</wsdl:message>
<wsdl:message name="getChildrenRequest">
<wsdl:part name="parameters" element="ns:getChildren" />
</wsdl:message>
<wsdl:message name="getChildrenResponse">
<wsdl:part name="parameters" element="ns:getChildrenResponse" />
</wsdl:message>
<!-- ******************* -->
<!-- ** PortTypes ** -->
<!-- ******************* -->
<wsdl:portType name="HelloWSPortType">
<wsdl:operation name="sayHello">
<wsdl:input message="ns:sayHelloRequest" wsaw:Action="urn:sayHello"/>
<wsdl:output message="ns:sayHelloResponse" wsaw:Action="urn:sayHelloResponse"/>
</wsdl:operation>
<wsdl:operation name="getTaxonomyNode">
<wsdl:input message="ns:getTaxonomyNodeRequest" wsaw:Action="urn:getTaxonomyNode" />
<wsdl:output message="ns:getTaxonomyNodeResponse" wsaw:Action="urn:getTaxonomyNodeResponse" />
</wsdl:operation>
<wsdl:operation name="getChildren">
<wsdl:input message="ns:getChildrenRequest" wsaw:Action="urn:getChildren" />
<wsdl:output message="ns:getChildrenResponse" wsaw:Action="urn:getChildrenResponse" />
</wsdl:operation>
</wsdl:portType>
<!-- ****************** -->
<!-- ** Bindings ** -->
<!-- ****************** -->
<wsdl:binding name="HelloWSServiceSoap11Binding" type="ns:HelloWSPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="sayHello">
<soap:operation soapAction="urn:sayHello" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTaxonomyNode">
<soap:operation soapAction="urn:getTaxonomyNode" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getChildren">
<soap:operation soapAction="urn:getChildren" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<!-- **************** -->
<!-- ** Service ** -->
<!-- **************** -->
<wsdl:service name="HelloWS">
<wsdl:port name="HelloWSServiceHttpSoap11Endpoint" binding="ns:HelloWSServiceSoap11Binding">
<soap:address location="http://162.16.129.25:9090/axis2/services/HelloWS"/>
</wsdl:port>
</wsdl:service>
I was having the same problem with Soap web services, that is I am getting null response. I found the reason is I need to add appropriate Header fields in the request: Say for example - content-type, content-encoding, etc., depending on the service written. You better check with the one who has written the web services
This could be because of separate WSDL files.
If you specify WSDL separately in META-INF then AXIS2 passes arguments of the webservice as an OMElement.
I.e. if you have used other datatypes as arguments in service API and you have a WSDL in META-INF then while calling Service the parameters are OMElement not String / int or etc...