Error while generating java classes from WSDL - java

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>

Related

Change xmlns value from endpointInterface

I'm having a Java webservice which looks like:
#WebService(endpointInterface = "vas.WSIF")
public class WSImpl implements WSIF {
}
and an endpointInterface:
#WebService ()
#SOAPBinding(style = SOAPBinding.Style.RPC)
public abstract interface WSIF {
}
My request have to be:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vas="http://vas/">
<soapenv:Header/>
<soapenv:Body>
<vas:sayhello>
<info>?</info>
</vas:sayhello>
</soapenv:Body>
</soapenv:Envelope>
How can I change xmlns:vas="http://vas/" in to another value like xmlns:vas="http://hellovas.com"?
I think it's just follow the package name right now.
<!--
Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e.
-->
<!--
Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.9-b130926.1035 svn-revision#5f6196f2b90e9460065a4c2f4e30e065b245e51e.
-->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://vas/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://vas/" name="WSImplService">
<types>
<xsd:schema>
<xsd:import namespace="http://vas/" schemaLocation="http://localhost:8080/API?xsd=1"/>
</xsd:schema>
</types>
<message name="register">
<part name="msisdn" type="xsd:string"/>
<part name="packageCode" type="xsd:string"/>
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="channel" type="xsd:string"/>
<part name="info" type="xsd:string"/>
</message>
<message name="registerResponse">
<part name="return" type="tns:registerResponse"/>
</message>
<message name="unregister">
<part name="msisdn" type="xsd:string"/>
<part name="packageCode" type="xsd:string"/>
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="channel" type="xsd:string"/>
<part name="info" type="xsd:string"/>
</message>
<message name="unregisterResponse">
<part name="return" type="tns:unregisterResponse"/>
</message>
<message name="packagelist">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="packagelistResponse">
<part name="return" type="tns:packagelistResponse"/>
</message>
<message name="checkstatus">
<part name="msisdn" type="xsd:string"/>
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="checkstatusResponse">
<part name="return" type="tns:checkstatusResponse"/>
</message>
<message name="decryptAES128">
<part name="input" type="xsd:string"/>
</message>
<message name="decryptAES128Response">
<part name="return" type="xsd:string"/>
</message>
<portType name="WSIF">
<operation name="register" parameterOrder="msisdn packageCode username password channel info">
<input wsam:Action="http://vas/WSIF/registerRequest" message="tns:register"/>
<output wsam:Action="http://vas/WSIF/registerResponse" message="tns:registerResponse"/>
</operation>
<operation name="unregister" parameterOrder="msisdn packageCode username password channel info">
<input wsam:Action="http://vas/WSIF/unregisterRequest" message="tns:unregister"/>
<output wsam:Action="http://vas/WSIF/unregisterResponse" message="tns:unregisterResponse"/>
</operation>
<operation name="packagelist" parameterOrder="username password">
<input wsam:Action="http://vas/WSIF/packagelistRequest" message="tns:packagelist"/>
<output wsam:Action="http://vas/WSIF/packagelistResponse" message="tns:packagelistResponse"/>
</operation>
<operation name="checkstatus" parameterOrder="msisdn username password">
<input wsam:Action="http://vas/WSIF/checkstatusRequest" message="tns:checkstatus"/>
<output wsam:Action="http://vas/WSIF/checkstatusResponse" message="tns:checkstatusResponse"/>
</operation>
<operation name="decryptAES128">
<input wsam:Action="http://vas/WSIF/decryptAES128Request" message="tns:decryptAES128"/>
<output wsam:Action="http://vas/WSIF/decryptAES128Response" message="tns:decryptAES128Response"/>
</operation>
</portType>
<binding name="WSImplPortBinding" type="tns:WSIF">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="register">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://vas/"/>
</input>
<output>
<soap:body use="literal" namespace="http://vas/"/>
</output>
</operation>
<operation name="unregister">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://vas/"/>
</input>
<output>
<soap:body use="literal" namespace="http://vas/"/>
</output>
</operation>
<operation name="packagelist">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://vas/"/>
</input>
<output>
<soap:body use="literal" namespace="http://vas/"/>
</output>
</operation>
<operation name="checkstatus">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://vas/"/>
</input>
<output>
<soap:body use="literal" namespace="http://vas/"/>
</output>
</operation>
<operation name="decryptAES128">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://vas/"/>
</input>
<output>
<soap:body use="literal" namespace="http://vas/"/>
</output>
</operation>
</binding>
<service name="WSImplService">
<port name="WSImplPort" binding="tns:WSImplPortBinding">
<soap:address location="http://localhost:8080/API"/>
</port>
</service>
</definitions>

SOAP Webservices

I have a wsdl containing SAOP Header and SOAP Body. I generated client with eclipse and APACHE CXF and sent request. But request is failing saying Header is missed or invalid.
<?xml version="1.0" encoding="UTF-8"?>
<types>
<xsd:schema>
<xsd:import
namespace="http://finservice.cl.com/Services/financier/Operational/Messages/Request"
schemaLocation="financierRequest.xsd"/>
<xsd:import
namespace="http://finservice.cl.com/Services/financier/Operational/Messages/Response"
schemaLocation="financierResponse6.xsd"/>
<xsd:import namespace="http://finservice.cl.com/Services/Faults"
schemaLocation="finserviceFaults.xsd"/>
<xsd:import namespace="http://www.cl.com/Services/SOAPHeaders"
schemaLocation="CLSoapHeaders.xsd"/>
<xsd:import
namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
schemaLocation="oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
</xsd:schema>
</types>
<message name="WS-Security-SOAPHeader">
<part element="wssec:Security" name="Security"/>
</message>
<message name="CLSOAPHeader">
<part element="hdr_ns:RequestContextHeader" name="requestHeader"/>
<part element="hdr_ns:ProcessingNodesHeader" name="processingNodesHeader"/>
</message>
<message name="financierRequest">
<part element="req_ns:financierRequestElement" name="financierRequestElement"/>
</message>
<message name="financierResponse">
<part element="res_ns:financierResponseElement" name="financierResponseElement"/>
</message>
<message name="Fault_Exception">
<part element="fault_ns:Fault" name="fault"/>
</message>
<portType name="finServicePortType">
<operation name="getFinanciers">
<input message="tns:financierRequest"/>
<output message="tns:financierResponse"/>
<fault message="tns:Fault_Exception" name="Fault_Exception"/>
</operation>
</portType>
<binding name="finServiceBinding" type="tns:finServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getFinanciers">
<soap:operation soapAction=""/>
<input>
<soap:body parts="financierRequestElement" use="literal"/>
<soap:header message="tns:CLSOAPHeader" part="requestHeader" use="literal"/>
<!-- soap:header message="tns:CLSOAPHeader" part="processingNodesHeader" use="optional"/-->
<soap:header message="tns:WS-Security-SOAPHeader" part="Security" use="literal"/>
</input>
<output>
<soap:body use="literal"/>
<soap:header message="tns:CLSOAPHeader" part="processingNodesHeader" use="literal"/>
<soap:header message="tns:WS-Security-SOAPHeader" part="Security" use="literal"/>
</output>
<fault name="Fault_Exception">
<soap:fault name="Fault_Exception" use="literal"/>
</fault>
</operation>
</binding>
<service name="financierService_v4">
<port binding="tns:finServiceBinding" name="finServicePort">
<soap:address location="http://finservice.qtcorpCL.cl.com:20021/finservService"/>
</port>
</service>
Can any one guide me how to write client for this wsdl?
How to attach header for this.
Did you test this wsdl in soapui? https://www.soapui.org/
I would suggest to first see what is the request and response structure of this web than may be you can use same request structure in your eclipse client. Soapui is very easy to use.
To generate all the client artifacts, you would need to use wsimport and then read about SOAP clients... Simple JAX-WS client

SOAP Encoding is not supported

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

How to test a webservice / WSDL

I have generated this WSDL file...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. -->
<definitions targetNamespace="http://math/" name="MathServicesService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://math/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema>
<xsd:import namespace="http://math/" schemaLocation="MathServicesService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="addTwoInts">
<part name="parameters" element="tns:addTwoInts"/>
</message>
<message name="addTwoIntsResponse">
<part name="parameters" element="tns:addTwoIntsResponse"/>
</message>
<message name="multiplyTwoFloats">
<part name="parameters" element="tns:multiplyTwoFloats"/>
</message>
<message name="multiplyTwoFloatsResponse">
<part name="parameters" element="tns:multiplyTwoFloatsResponse"/>
</message>
<portType name="MathServices">
<operation name="addTwoInts">
<input message="tns:addTwoInts"/>
<output message="tns:addTwoIntsResponse"/>
</operation>
<operation name="multiplyTwoFloats">
<input message="tns:multiplyTwoFloats"/>
<output message="tns:multiplyTwoFloatsResponse"/>
</operation>
</portType>
<binding name="MathServicesPortBinding" type="tns:MathServices">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="addTwoInts">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="multiplyTwoFloats">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MathServicesService">
<port name="MathServicesPort" binding="tns:MathServicesPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
from this class...
package math;
import javax.jws.WebService;
#WebService
public class MathServices {
public int addTwoInts(int int1, int int2){
return int1+int2;
}
public float multiplyTwoFloats(float float1, float float2){
return float1 * float2;
}
}
How can I test to see if this webservice is working properly using the WSDL? I don't understand how the functionality (int1+int2 and float1*float2) translates to the XML. All I see in the WSDL are what translate to method names and parameter names. I don't see where the math goes on. :/
That said, where do the parameters come from when using the webservice? How do you even use the webservice? Can I just use it through my browser?
For soap you can use SoapUI. See http://www.soapui.org/.
You can test WSDLs with SoapUI.

WSDL generate method with no parameters

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

Categories