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...
Related
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>
I am trying to generate the web service client from WSDL , I am quiet new to this so can't figure out the error.
I have tried:
wsimport -keep path-to-wsdl
which gives me this error :
C:\WINDOWS\system32>wsimport -keep E:\NIEsocketWork\sdl.wsdl
parsing WSDL...
[WARNING] src-resolve.4.2: Error resolving component 'tns:GetMerchantRateRequest'. It was detected that 'tns:GetMerchantRateRequest' is in namespace 'http://www.fexcodcc.com/DCC20071126', but components from this namespace are not referenceable from schema document 'file:/E:/NIEsocketWork/sdl.wsdl#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'tns:GetMerchantRateRequest' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/E:/NIEsocketWork/sdl.wsdl#types?schema1'.
line 20 of file:/E:/NIEsocketWork/sdl.wsdl#types?schema1
[WARNING] src-resolve: Cannot resolve the name 'tns:GetMerchantRateRequest' to a(n) 'type definition' component.
line 20 of file:/E:/NIEsocketWork/sdl.wsdl#types?schema1
[ERROR] undefined simple or complex type 'tns:GetMerchantRateRequest'
line 20 of file:/E:/NIEsocketWork/sdl.wsdl
[ERROR] undefined simple or complex type 'tns:GetMerchantRateResponse'
line 26 of file:/E:/NIEsocketWork/sdl.wsdl
[ERROR] undefined simple or complex type 'tns:GetCardRateRequest'
line 79 of file:/E:/NIEsocketWork/sdl.wsdl
[ERROR] undefined simple or complex type 'tns:GetCardRateResponse'
line 85 of file:/E:/NIEsocketWork/sdl.wsdl
Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
at com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:129)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2283)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:183)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
I have also tried apache cxf 3.1.1 to generate the web service client in eclipse but get this error :
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -client -d C:\Users\Hamza\GalileoWorkspace\NIDCCFexco\.cxftmp/src -classdir C:\Users\Hamza\GalileoWorkspace\NIDCCFexco\build\classes -p http://www.fexcodcc.com/DCC20071126=com.fexcodcc.dcc20071126 -impl -validate -exsh false -dns true -dex true -wsdlLocation file:///E:/NIEsocketWork/sdl.wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 file:/E:/NIEsocketWork/sdl.wsdl
wsdl2java - Apache CXF 3.1.1
WSDLToJava Error:
Summary: Failures: 4, Warnings: 0
<<< ERROR!
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateOut> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateResult> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetCardRateOut> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetCardRateResult> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetCardRateIn> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetCardRate> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateIn> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetMerchantRate> can not be found in the schemas
org.apache.cxf.tools.common.ToolException:
Summary: Failures: 4, Warnings: 0
<<< ERROR!
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateOut> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateResult> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetCardRateOut> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetCardRateResult> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetCardRateIn> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetCardRate> can not be found in the schemas
Part <parameters> in Message <{http://www.fexcodcc.com/DCC20071126}GetMerchantRateIn> referenced Type <{http://www.fexcodcc.com/DCC20071126}GetMerchantRate> can not be found in the schemas
at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:139)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:207)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:204)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:415)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
My WSDL file is :
<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions targetNamespace="http://www.fexcodcc.com/DCC20071126"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns="http://www.fexcodcc.com/DCC20071126"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation>DCC Gateway (Provides functionality to make requests to the DCC for availability)</wsdl:documentation>
<!-- Types --> <wsdl:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http:// www.fexcodcc.com/DCC20071126" xmlns:dhs="urn:dhs">
<!-- Type definitions -->
<xsd:element name="GetMerchantRate"> <xsd:complexType>
<xsd:sequence>
<xsd:element name="GetMerchantRateRequest" type="tns:GetMerchantRateRequest" minOccurs="1" maxOccurs="1"/>
</xsd:sequence> </xsd:complexType>
</xsd:element>
<xsd:element name="GetMerchantRateResult"> <xsd:complexType>
<xsd:sequence>
<xsd:element name="GetMerchantRateResponse" type="tns:GetMerchantRateResponse" minOccurs="1" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
</xsd:element>
<!-- Complex type definitions -->
<xsd:complexType name="GetMerchantRateResponse"> <xsd:sequence>
<xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ExchangeRate" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="FgnCurCode" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="FgnAmount" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="DccOffered" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValidHours" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="MarginRatePercentage" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ExchangeRateSourcename" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="CommissionPercentage" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ExchangerateSourceTimestamp" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="MinorUnits" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ResponseCode" type="xsd:string" minOccurs="1" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
<xsd:complexType name="GetMerchantRateRequest"> <xsd:sequence>
<xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="MerchantId" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="Acquirer" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="FgnCurCode" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="BaseAmount" type="xsd:string" minOccurs="0" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
<xsd:element name="GetCardRate"> <xsd:complexType>
<xsd:sequence>
<xsd:element name="GetCardRateRequest" type="tns:GetCardRateRequest" minOccurs="1" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
</xsd:element>
<xsd:element name="GetCardRateResult"> <xsd:complexType>
<xsd:sequence>
<xsd:element name ="GetCardRateResponse" type="tns:GetCardRateResponse" minOccurs="1" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
</xsd:element>
<!-- Complex type definitions --> <xsd:complexType name="GetCardRateResponse">
<xsd:sequence>
<xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ExchangeRate" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="FgnCurCode" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="FgnAmount" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="DccOffered" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ValidHours" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="MarginRatePercentage" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ExchangeRateSourceName" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="CommissionPercentage" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="ExchangeRateSourceTimestamp" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="MinorUnits" type="xsd:string" minOccurs="0" maxOccurs="1" /><xsd:element name="ResponseCode" type="xsd:string" minOccurs="1" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
<xsd:complexType name="GetCardRateRequest"> <xsd:sequence>
<xsd:element name="ReferenceNumber" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="CardId" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="MerchantId" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="Acquirer" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="BaseAmount" type="xsd:string" minOccurs="0" maxOccurs="1" />
</xsd:sequence> </xsd:complexType>
</xsd:schema> </wsdl:types>
<!-- Dhs Server Messages --> <wsdl:message name="GetMerchantRateIn">
<wsdl:part name="parameters" element="tns:GetMerchantRate" /> </wsdl:message>
<wsdl:message name="GetMerchantRateOut">
<wsdl:part name="parameters" element="tns:GetMerchantRateResult" /> </wsdl:message>
<wsdl:message name="GetCardRateIn">
<wsdl:part name="parameters" element="tns:GetCardRate" /> </wsdl:message>
<wsdl:message name="GetCardRateOut">
<wsdl:part name="parameters" element="tns:GetCardRateResult" /> </wsdl:message>
<!-- End of Dhs Server Messages -->
<!-- Port types --> <wsdl:portType name="DHS">
<wsdl:operation name="getMerchantRate">
<wsdl:documentation>Get Exchange Rate for merchant</wsdl:documentation> <wsdl:input message="tns:GetMerchantRateIn" />
<wsdl:output message="tns:GetMerchantRateOut" /> </wsdl:operation>
<wsdl:operation name="getCardRate">
<wsdl:documentation>Get Dynamic Currency conversion</wsdl:documentation> <wsdl:input message="tns:GetCardRateIn" />
<wsdl:output message="tns:GetCardRateOut" /> </wsdl:operation>
<!-- End of Dhs Server Operations --> </wsdl:portType>
<!-- WSDL bindings -->
<wsdl:binding name="DHS12" type="tns:DHS"> <wsdl:documentation>
<wsi:Claim conformsTo="http://ws-i.org/profiles/basic/1.1" /> </wsdl:documentation>
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="getMerchantRate">
<soap12:operation soapAction="http://www.fexcodcc.com/DCC20071126/ getMerchantRate" style="document" />
<wsdl:input>
<soap12:body use="literal" /> </wsdl:input>
<wsdl:output>
<soap12:body use="literal" /> </wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCardRate">
<soap12:operation soapAction="http://www.fexcodcc.com/DCC20071126/ getCardRate" style="document" />
<wsdl:input>
<soap12:body use="literal" /> </wsdl:input>
<wsdl:output>
<soap12:body use="literal" /> </wsdl:output>
</wsdl:operation> </wsdl:binding>
<!-- WSDL service -->
<wsdl:service name="DHS">
<wsdl:documentation> DHS Server(Provides functionality to make DCC availability requests)</wsdl:documentation>
<wsdl:port name="DHS12" binding="tns:DHS12">
<soap12:address location="dhstest2.fexcodccapps.com/axis2/services/DHS" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
please help me figure out the error in any of the ways, whether wsimport or apache cxf. I will be really grateful.
in the schema declaration there is a space too much after the slashes: http:// www.fexcodcc.com/DCC20071126 instead of http://www.fexcodcc.com/DCC20071126.
try removing that space and it validates.
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 an issue with SOAPAction that contains accents.
From a third-party WSDL, I have generated Java Classes using CXF wsdl2java plugin. Using the generated classes, I have developed a CXF-based client and server. The problem is that the server fail to get the client's request with the following error :
2014-06-19 11:45:08,423 [qtp1051344475-17] WARN - Interceptor for {http://simulator.be.connectors.cam/}RIBSOAPSoapImplService#{http://tempuri.org/}Opération_1 has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: The given SOAPAction http://tempuri.org/RIB_SOAP/Opération_1 does not match an operation.
at org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor$SoapActionInAttemptTwoInterceptor.handleMessage(SoapActionInInterceptor.java:188)
at org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor$SoapActionInAttemptTwoInterceptor.handleMessage(SoapActionInInterceptor.java:163)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at ...
The log of the request at the client side shows the correct value of the SOAPAction while the request at the server side shows the wrong value.
The request at the client side is :
2014-06-19 11:45:08,349 [main] INFO - Outbound Message
---------------------------
ID: 1
Address: http://localhost:17081/SIMULATOR/RIB/WS
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], Connection=[Keep-Alive], SOAPAction=["http://tempuri.org/RIB_SOAP/Opération_1"]}
Payload: <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:Opération_1 xmlns:ns2="http://Rib_InSchema" xmlns:ns3="http://tempuri.org/" xmlns:ns4="http://Rib_OutSchema">
<ns2:Root>
<RIB>1234567890</RIB>
</ns2:Root>
</ns3:Opération_1>
</soap:Body>
</soap:Envelope>
--------------------------------------
The request at the server side is :
2014-06-19 11:45:08,408 [qtp1051344475-17] INFO - Inbound Message
----------------------------
ID: 2
Address: http://localhost:17081/SIMULATOR/RIB/WS
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml; charset=UTF-8
Headers: {Accept=[*/*], Cache-Control=[no-cache], connection=[keep-alive], Content-Length=[339], content-type=[text/xml; charset=UTF-8], Host=[localhost:17081], Pragma=[no-cache], SOAPAction=["http://tempuri.org/RIB_SOAP/Opération_1"], User-Agent=[Apache CXF 2.7.10]}
Payload: <?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns3:Opération_1 xmlns:ns2="http://Rib_InSchema" xmlns:ns3="http://tempuri.org/" xmlns:ns4="http://Rib_OutSchema">
<ns2:Root>
<RIB>1234567890</RIB>
</ns2:Root>
</ns3:Opération_1>
</soap:Body>
</soap:Envelope>
--------------------------------------
As you can see from the logs, the UTF-8 is the used encoding at all levels. However, for some reason, at the server side, the SOAPAction has been decoded using ISO-8859-1.
The used WSDL is :
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/"
xmlns:s1="http://Rib_InSchema" xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s2="http://Rib_OutSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly
"BTS, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=dab3109d17486051" published web service.
</wsdl:documentation>
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:import namespace="http://Rib_InSchema" />
<s:import namespace="http://Rib_OutSchema" />
<s:element name="Opération_1">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" ref="s1:Root" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Opération_1Response">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" ref="s2:Root" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="http://Rib_InSchema">
<s:element name="Root">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="RIB" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<s:schema elementFormDefault="qualified"
targetNamespace="http://Rib_OutSchema">
<s:element name="Root">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="NumCompte" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Nom" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Prenom" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="Agence" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="AgenceAdresse" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified"
name="RIB" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="Opération_1SoapIn">
<wsdl:part name="parameters" element="tns:Opération_1" />
</wsdl:message>
<wsdl:message name="Opération_1SoapOut">
<wsdl:part name="parameters" element="tns:Opération_1Response" />
</wsdl:message>
<wsdl:portType name="RIB_SOAPSoap">
<wsdl:operation name="Opération_1">
<wsdl:input message="tns:Opération_1SoapIn" />
<wsdl:output message="tns:Opération_1SoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="RIB_SOAPSoap"
type="tns:RIB_SOAPSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Opération_1">
<soap:operation
soapAction="http://tempuri.org/RIB_SOAP/Opération_1"
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="RIB_SOAPSoap12"
type="tns:RIB_SOAPSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Opération_1">
<soap12:operation
soapAction="http://tempuri.org/RIB_SOAP/Opération_1"
style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RIB_SOAP">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly
"BTS, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=dab3109d17486051" published web service.
</wsdl:documentation>
<wsdl:port name="RIB_SOAPSoap"
binding="tns:RIB_SOAPSoap">
<soap:address
location="http://localhost/BTS_Proxy/RIB_SOAP.asmx" />
</wsdl:port>
<wsdl:port name="RIB_SOAPSoap12"
binding="tns:RIB_SOAPSoap12">
<soap12:address
location="http://localhost/BTS_Proxy/RIB_SOAP.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Spring conf for the client:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
"
>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<http-conf:conduit name=".*">
<http-conf:client ConnectionTimeout="30000" ReceiveTimeout="30000" />
</http-conf:conduit>
<jaxws:client
id="ribWebServiceClient"
serviceClass="org.tempuri.RIBSOAPSoap"
address="${ws.rib.url}"
>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" >
<property name="prettyLogging" value="true" />
</bean>
</jaxws:features>
<jaxws:properties>
<entry key="exceptionMessageCauseEnabled" value="true" />
<entry key="faultStackTraceEnabled" value="true" />
</jaxws:properties>
</jaxws:client>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
</beans>
Spring conf for the server:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
"
>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~-->
<jaxws:endpoint
id="ribWebServiceEndPoint"
implementor="#ribWebService"
address="${ws.rib.url}"
>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" >
<property name="prettyLogging" value="true" />
</bean>
</jaxws:features>
<jaxws:properties>
<entry key="exceptionMessageCauseEnabled" value="true" />
<entry key="faultStackTraceEnabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
<!--.~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~..~~~~~~~~-->
</beans>
According to the HTTP spec, all the HTTP headers are supposed to be ISO-8859-1. There is an separate spec for how to encode non-ISO-8859-1 characters into the header (https://www.rfc-editor.org/rfc/rfc2047) but I'm not sure if the HTTPUrlConnection object in the JDK supports that or not. I'm also not sure if other soap client would support it either.
I would strongly suggest making sure the SOAPAction values would be ISO-8859-1 compatible.
Please refer to this discussion in CXF Users Mainling List. As mentioned by Aki, HTTP Specs requires that HTTP Headers use only US-ASCII characters (see rfc2822). And as mentioned by Daniel and Aki, the spec rfc2047 should be used in case there is a need to use a none US-ASCII character.
The solution for this issue is to avoid using characters that are not US-ASCII characters (include accented characters of course).
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>