I try to generate webservice using WSDL file. There is one method with no input parameter. I did it the following way:
...
<types>
<xsd:schema targetNamespace="http://api.registration.company.com"
xmlns:base="http://base.api.registration.company.com">
...
<xsd:element name="RemoveURLRequest">
<xsd:complexType>
<xsd:sequence />
</xsd:complexType>
</xsd:element>
<xsd:element name="RemoveURLResponse" type="xsd:boolean" />
</xsd:schema>
</types>
...
<message name="RemoveURLRequest">
<part name="RemoveURLRequest" element="tns:RemoveURLRequest" />
</message>
<message name="RemoveURLResponse">
<part name="RemoveURLResponse" element="tns:RemoveURLResponse" />
</message>
...
<portType name="RegistrationService">
...
<operation name="RemoveURL">
<input message="tns:RemoveURLRequest" />
<output message="tns:RemoveURLResponse" />
</operation>
...
</portType>
<binding name="RegistrationServiceSOAP" type="tns:RegistrationService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
...
<operation name="RemoveURL">
<soap:operation soapAction=
"http://api.registration.company.com/web/services/RegistrationService/RemoveURL"
style="document" />
<input>
<soap:body parts="RemoveURLRequest" use="literal" />
</input>
<output>
<soap:body parts="RemoveURLResponse" use="literal" />
</output>
</operation>
</binding>
<service name="RegistrationService">
<port name="RegistrationServiceSOAP" binding="tns:RegistrationServiceSOAP">
<soap:address location=
"http://api.registration.company.com/web/services/RegistrationService" />
</port>
</service>
According to this WSDL I expect method to be generated like this:
public boolean removeURL();
But I'm getting this:
public boolean removeURL(RemoveURLRequest removeURLRequest);
Where RemoveURLRequest is an empty class:
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "")
#XmlRootElement(name = "RemoveURLRequest")
public class RemoveURLRequest {
}
What am I doing wrong?
try some thing like this
<message name="RemoveURLRequest">
</message>
without using the part element.
You must create an empty complex Type and use it as parameter. see the following post which is a similar question : WSDL Type for getter without parameter.
Jax-WS usually generate such code when the message/part/schema types ends with the keyword "Request". Give it a try without by removing the "Request" part of the name. This should give you the expected results
Related
I have problem to generate java classes from wsdl. I am using Intelij. Wsdl is written on php. I wrote client on php and it works fine. In java I have generators such are: wsimport, axis and axis 2 but with no result.
This is error on axis:
org.xml.sax.SAXException: Fatal Error: URI=myurl.wsdl Line=1: White spaces are required between publicId and systemId.
at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils.java:723)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1427)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanExternalID(XMLScanner.java:1039)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDoctypeDecl(XMLDocumentScannerImpl.java:687)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:420)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:482)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:662)
this error on axis 2:
[Fatal Error] Natgeo3.wsdl:1:50: White spaces are required between publicId and systemId.
log4j:WARN No appenders could be found for logger (org.apache.axis2.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:180)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:50)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'https://nationalgeographic.ge/soap/Natgeo3.wsdl'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:312)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:134)
... 2 more
Caused by: org.xml.sax.SAXParseException; systemId: myurl.wsdl; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
... 7 more
and this is on wsimport:
[ERROR] DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
line 1 of myurl.wsdl
[ERROR] DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.
Failed to read the WSDL document: myurl.wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
[ERROR] Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
And here is sample wsdl:
<?xml version="1.0"?>
<definitions name="Natgeo" targetNamespace="urn:Natgeo" xmlns:tns="urn:Natgeo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Natgeo">
<xsd:element name="getName" type="xsd:string" />
<xsd:element name="HelloResponse" type="xsd:string" />
<xsd:element name="doSQL" type="xsd:string" />
<xsd:element name="SQLResponse" type="xsd:string" />
<xsd:element name="tbcpay" type="xsd:string" />
<xsd:element name="tbcpayResponse" type="xsd:string" />
<xsd:element name="doSILKNET" type="xsd:string" />
<xsd:element name="SILKNETResponse" type="xsd:string" />
<xsd:element name="INDEX" type="xsd:string" />
<xsd:element name="INDEXResponse" type="xsd:string" />
</xsd:schema>
</types>
<message name="dotbcpay">
<part name="parameters" type="tns:tbcpay" />
</message>
<message name="dotbcpayResponse">
<part name="parameters" type="tns:tbcpayResponse" />
</message>
<message name="doHello">
<part name="parameters1" type="tns:getName" />
</message>
<message name="doHelloResponse">
<part name="parameters2" type="tns:HelloResponse" />
</message>
<message name="doSQL">
<part name="parameters3" type="tns:doSQL" />
</message>
<message name="doSQLResponse">
<part name="parameters4" type="tns:SQLResponse" />
</message>
<message name="doSILKNET">
<part name="parameters5" type="tns:doSILKNET" />
</message>
<message name="doSILKNETResponse">
<part name="parameters6" type="tns:SILKNETResponse" />
</message>
<message name="doINDEX">
<part name="parameters7" type="tns:INDEX" />
</message>
<message name="doINDEXResponse">
<part name="parameters8" type="tns:INDEXResponse" />
</message>
<portType name="HelloPort">
<operation name="doHello">
<input message="tns:doHello" />
<output message="tns:doHelloResponse" />
</operation>
<operation name="doSQL">
<input message="tns:doSQL" />
<output message="tns:doSQLResponse" />
</operation>
<operation name="dotbcpay">
<input message="tns:dotbcpay" />
<output message="tns:dotbcpayResponse" />
</operation>
<operation name="doSILKNET">
<input message="tns:doSILKNET" />
<output message="tns:doSILKNETResponse" />
</operation>
<operation name="doINDEX">
<input message="tns:doINDEX" />
<output message="tns:doINDEXResponse" />
</operation>
</portType>
<binding name="HelloBinding" type="tns:HelloPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="doHello">
<soap:operation soapAction="urn:HelloAction" />
<input>
<soap:body use="encoded" namespace="urn:Natgeo" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:Natgeo" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="doSQL">
<soap:operation soapAction="urn:SQLAction" />
<input>
<soap:body use="encoded" namespace="urn:SQL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:SQL" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="dotbcpay">
<soap:operation soapAction="urn:tbcpayAction" />
<input>
<soap:body use="encoded" namespace="urn:tbcpay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:tbcpay" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="doSILKNET">
<soap:operation soapAction="urn:SILKNETAction" />
<input>
<soap:body use="encoded" namespace="urn:SILKNET" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:SILKNET" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
<operation name="doINDEX">
<soap:operation soapAction="urn:INDEXAction" />
<input>
<soap:body use="encoded" namespace="urn:INDEX" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:INDEX" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloBinding">
<soap:address location="wsdllocation" />
</port>
</service>
</definitions>
I'm trying to use a third-party java-based webservice from a .net application. The thing is I'm having compatibility issues regarding the given wsdl. When I try to include this wsdl in my VStudio project I'm getting this message:
Warning: 'name' attribute is invalid. The value 'envio:Foo_Envio" is invalid for data type' http://www.w3.org/2001/XMLSchema:NCName '- The':' character, hexadecimal value 0x3A, can not be used in a name . Line 17, position 20
I've read here that they shouldn't use a colon character in the name attribute, because as a NCName type it's only allowed to use a very short set of them. The thing is when I import this wsdl in a Eclipse web project I've no issues at all. Does any of you have any clue about what's happening in Eclipse that doesn't work in VS?
Thanks in advance.
The concerning wsdl code:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:Foo="transmision" xmlns:envio="envio.xsd" xmlns:recepcion="recepcion.xsd" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="transmision">
<types>
<schema elementFormDefault="qualified" xmlns:Foo="transmision" xmlns:envio="transmision" xmlns:FooRecepcion="recepcion.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="recepcion.xsd" schemaLocation="recepcion.xsd"/>
<xsd:import namespace="envio.xsd" schemaLocation="envio.xsd"/>
</schema>
</types>
<message name="Foo_Envio">
<part name="envio" element="envio:envio"/>
</message>
<message name="Foo_Recepcion">
<part name="recepcion" element="recepcion:confirmacionRecepcion"/>
</message>
<portType name="Foo">
<operation name="Foo">
<input name="envio:Foo_Envio" message="Foo:Foo_Envio"/>
<output name="envio:Foo_Recepcion" message="Foo:Foo_Recepcion"/>
</operation>
</portType>
<binding name="FooSoapBinding" type="Foo:Foo">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Foo">
<input>
<wsdlsoap:body use="literal"/>
</input>
<output>
<wsdlsoap:body use="literal"/>
</output>
</operation>
</binding>
<service name="FooService">
<port name="Foo" binding="Foo:FooSoapBinding">
<wsdlsoap:address location="https://ws.whatever.com/iniinvoc/es.foo.Foos.ws.EnvioSOAP"/>
</port>
</service>
</definitions>
In the end we've contacted with the third-party and they've changed the name attribute, removing the ":" character.
I'm newbie with web services and java, so I have some issues to connect my application with an external Web Service. I get all the time this exception
The message with Action '' cannot be processed at the receiver
Maybe my assumptions are wrong, but I think the action is defined inside the SOAP payload. Here is the WSDL:
<?xml version='1.0'?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.tempuri.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tempuri.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types />
<message name="BINICIARREPORTRequest">
<part name="EAUSUARIO" type="xsd:string" />
<part name="EAMODULO" type="xsd:string" />
<part name="EANOMREPOR" type="xsd:string" />
<part name="EAPARAMREPOR" type="xsd:string" />
<part name="EANOMPANTA" type="xsd:string" />
</message>
<message name="BINICIARREPORTResponse">
<part name="RESULT" type="xsd:boolean" />
</message>
<portType name="PWS_LANZA_REPOR_PORT_1">
<operation name="BINICIARREPORT">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<input message="tns:BINICIARREPORTRequest" />
<output message="tns:BINICIARREPORTResponse" />
</operation>
</portType>
<binding name="PWS_LANZA_REPOR_PORT_1Soap" type="tns:PWS_LANZA_REPOR_PORT_1">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<operation name="BINICIARREPORT">
<soap:operation soapAction="http://www.tempuri.org/wsdl/BINICIARREPORTRequest" style="rpc" />
<input name="BINICIARREPORTRequest">
<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output name="BINICIARREPORTResponse">
<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="PWS_LANZA_REPOR">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<port name="PWS_LANZA_REPOR_PORT_1Port" binding="tns:PWS_LANZA_REPOR_PORT_1Soap">
<soap:address location="" />
</port>
</service>
</definitions>
Here is the code I'm using:
final String endpointUrl = this.configuracion
.getConfigJNDI(WS_MECANIZACION_JNDI);
final QName serviceName = new QName(null,
"PWS_LANZA_REPOR");
final QName portName = new QName(null, "PWS_LANZA_REPOR_PORT_1Port");
final javax.xml.ws.Service service = javax.xml.ws.Service
.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointUrl);
final Dispatch<SOAPMessage> dispatch = service.createDispatch(
portName, SOAPMessage.class,
javax.xml.ws.Service.Mode.MESSAGE);
final SOAPMessage response = dispatch.invoke(mensajeSOAP);
If I use SoapUI to check this out, everything works fine (the message is OK as well as the endpointURL), but no success whatsoever from the java application.
This is the soap message I'm sending:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="s" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<wsdl:BINICIARREPORT xmlns:wsdl="cosa">
<EAUSUARIO>CD</EAUSUARIO>
<EAMODULO>PR</EAMODULO>
<EANOMREPOR>PRR14</EANOMREPOR>
<EAPARAMREPOR/>
<EANOMPANTA/>
</wsdl:BINICIARREPORT>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I don't know whether this is important, but the url I was given has no "?wsdl" at then end:
http://prueba/prueba/Pws_Lanza_Rep1.svc
Any clues?
I haven't figured it out yet, but following the steps here everything worked fine!
I have used the same xml and the same parameters, so it still remains a mistery to me why the previous code didn't work.
I have WSDL url like with below format and that seems is correct. After using wsimport in terminal for parse that I get an error:
Run from terminal:
tux-world#alachiq:~/Desktop/Project/java > wsimport -keep -s wsdl/ example.com/wsdl/wsdl.php?wsdl
parsing WSDL...
[ERROR] "Use of SOAP Encoding is not supported.
SOAP extension element on line 59 in example.com/wsdl/wsdl.php?wsdl has use="encoded" "
Failed to parse the WSDL.
WSDL for Parse:
<?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:tsmswsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:tsmswsdl">
<types>
<xsd:schema targetNamespace="urn:tsmswsdl"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="outGetMessages">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="GetMessagesRequest">
<part name="user" type="xsd:string" />
<part name="pass" type="xsd:string" />
<part name="idend" type="xsd:int" />
<part name="count_request" type="xsd:int" /></message>
<message name="GetMessagesResponse">
<part name="return" type="tns:outGetMessages" /></message>
<message name="login_checkRequest">
<part name="user" type="xsd:string" />
<part name="pass" type="xsd:string" /></message>
<message name="login_checkResponse">
<part name="return" type="tns:outGetMessages" /></message>
<message name="send_smsRequest">
<part name="user" type="xsd:string" />
<part name="pass" type="xsd:string" />
<part name="sms_number" type="xsd:string" />
<part name="mobile" type="xsd:string" />
<part name="msg" type="xsd:string" />
<part name="send_date" type="xsd:string" /></message>
<message name="send_smsResponse">
<part name="return" type="tns:outGetMessages" /></message>
<portType name="tsmswsdlPortType">
<operation name="GetMessages">
<documentation>Get specific user info</documentation>
<input message="tns:GetMessagesRequest"/>
<output message="tns:GetMessagesResponse"/>
</operation>
<operation name="login_check">
<documentation>Get specific user info</documentation>
<input message="tns:login_checkRequest"/>
<output message="tns:login_checkResponse"/>
</operation>
<operation name="send_sms">
<documentation>Get specific user info</documentation>
<input message="tns:send_smsRequest"/>
<output message="tns:send_smsResponse"/>
</operation>
</portType>
<binding name="tsmswsdlBinding" type="tns:tsmswsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetMessages">
<soap:operation soapAction="urn:tsmswsdl#GetMessages" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="login_check">
<soap:operation soapAction="urn:tsmswsdl#login_check" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="send_sms">
<soap:operation soapAction="urn:tsmswsdl#send_sms" style="rpc"/>
<input><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="urn:tsmswsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="tsmswsdl">
<port name="tsmswsdlPort" binding="tns:tsmswsdlBinding">
<soap:address location="example.com/wsdl/wsdl.php"/>
</port>
</service>
</definitions>
To remove the ambiguity over whether this question has an answer or not, I'm posting the answer from the comments of #Roman Vottner:
Version 2 of JAX-WS does not support rpc/encoded. If you are in control of the web service try changing rpc/encoded to document/literal.
Suggested readings:
link 1
link 2
link 3
link 4
link 5
I am new to camel
I am trying to call webservice using camel java dsl
from("cxf://http://darshan:8080/sampleWebService/SampleTestServicePort?wsdlURL=http://darshan:8080/sampleWebService/SampleTestServicePort?wsdl&serviceName={http://ws.test.com/}SampleTestServiceService&portName={http://ws.test.com/}SampleTestServicePort&dataFormat=MESSAGE")
following is my wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.test.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.test.com/" name="SampleTestServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.test.com/" schemaLocation="http://darshan:808O/sampleWebService/SampleTestServicePort?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"></part>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"></part>
</message>
<portType name="SampleTestServiceDelegate">
<operation name="sayHello">
<input message="tns:sayHello"></input>
<output message="tns:sayHelloResponse"></output>
</operation>
</portType>
<binding name="SampleTestServicePortBinding" type="tns:SampleTestServiceDelegate">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="sayHello">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="SampleTestServiceService">
<port name="SampleTestServicePort" binding="tns:SampleTestServicePortBinding">
<soap:address location="http://darshan:808O/sampleWebService/SampleTestServicePort"></soap:address>
</port>
</service>
</definitions>
That gives no error but also output is nothing.
Please suggest me what is wrong in my code.
Thanks in advance
When you use the Apache CXF Component as a from() what you are doing is you are hosting the webservice instead of accessing a third-party one.
To access a third-party service you need to use the to() form of the component. You need to do something like this:
<route>
<from uri="file:./myFileRequest?delay=1000&include=myRequest.xml">
<to uri="cxf://http://darshan:8080/sampleWebService/SampleTestServicePort?wsdlURL=http://darshan:8080/sampleWebService/SampleTestServicePort?wsdl&serviceName={http://ws.test.com/}SampleTestServiceService&portName={http://ws.test.com/}SampleTestServicePort&dataFormat=MESSAGE" />
...
</route>
Is this what you are looking for?
Define the cxf bean as below in the camel context
<cxf:cxfEndpoint
address="Service ENDPOINT"
endpointName="give wsdl:port#name here from wsdl"
id="any id" loggingFeatureEnabled="true"
serviceClass="your service class - it will be inside the stubs generated from WSDL"
serviceName="Service Name"
wsdlURL="WSDL path" xmlns:ws="namespace">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
</cxf:properties>
</cxf:cxfEndpoint>
then write the following in your route:
<to id="_to1" uri="cxf:bean:id Of the cxfEndpoint bean"/>