SOAP Encoding is not supported - java

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

Related

Error while generating java classes from WSDL

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>

web services how to get the wsdl from the url web service

I have the web service url
http://seguriteca.sir.renfe.es/u35/GDN/Seguriteca2017/Normativa.nsf/DegradadoMercancias
and I want to get the wsdl to obtain the java classes from java.
How can I get the wsdl?
Edited.
I attach my wsdl. I want to know which are the java classes generated from this wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="urn:DefaultNameSpace"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:DefaultNameSpace" xmlns:intf="urn:DefaultNameSpace"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="urn:DefaultNameSpace"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="LINEAS" type="xsd:string" />
<element name="TRAMOS" type="xsd:string" />
<element name="CODUSUARIO" type="xsd:string" />
<element name="NOMUSUARIO" type="xsd:string" />
<complexType name="LISTADO">
<sequence>
<element name="RESULTADO" type="xsd:string" />
<element name="MSG" type="xsd:string" />
</sequence>
</complexType>
<element name="LISTADODOCUMENTOSReturn" type="impl:LISTADO" />
</schema>
</wsdl:types>
<message name="LISTADODOCUMENTOSRequest">
<part element="impl:LINEAS" name="LINEAS" />
<part element="impl:TRAMOS" name="TRAMOS" />
<part element="impl:CODUSUARIO" name="CODUSUARIO" />
<part element="impl:NOMUSUARIO" name="NOMUSUARIO" />
</message>
<message name="LISTADODOCUMENTOSResponse">
<part element="impl:LISTADODOCUMENTOSReturn"
name="LISTADODOCUMENTOSReturn" />
</message>
<portType name="DegradadoMercanciasNotes">
<operation name="LISTADODOCUMENTOS">
<input message="impl:LISTADODOCUMENTOSRequest"
name="LISTADODOCUMENTOSRequest" />
<output message="impl:LISTADODOCUMENTOSResponse"
name="LISTADODOCUMENTOSResponse" />
</operation>
</portType>
<binding name="DominoSoapBinding"
type="impl:DegradadoMercanciasNotes">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="LISTADODOCUMENTOS">
<wsdlsoap:operation soapAction="" />
<input name="LISTADODOCUMENTOSRequest">
<wsdlsoap:body use="literal" />
</input>
<output name="LISTADODOCUMENTOSResponse">
<wsdlsoap:body use="literal" />
</output>
</operation>
</binding>
<service name="DegradadoMercanciasNotesService">
<port binding="impl:DominoSoapBinding" name="Domino">
<wsdlsoap:address
location="http://seguriteca.sir.renfe.es:80/u35/GDN/Seguriteca2017/Normativa.nsf/DegradadoMercancias?OpenWebService" />
</port>
</service>
</definitions>
It depends on the framework been used for Web Service implementation.
Usually you can find it appending "?wsdl" or ".wsdl" to the web service URL.
So, I would try with http://seguriteca.sir.renfe.es/u35/GDN/Seguriteca2017/Normativa.nsf/DegradadoMercancias?wsdl or http://seguriteca.sir.renfe.es/u35/GDN/Seguriteca2017/Normativa.nsf/DegradadoMercancias.wsdl

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>

PHP: Error calling SOAP rpc webservice from Java - Worked before

I have a java program which calls methods in php (rpc) over SOAP.
Since a couple of days it does not work anylonger from my existing code.
On my dev machine I recently updated to php7.0, but on the remote server there is still php5.x running. It neither works with localhost, nor with the remote server. Both machines are running Ubuntu (dev 16.04, remote 14.04)
I always get the following error:
[SOAPException: faultCode=SOAP-ENV:Client; msg=Parsing error, response was:
The processing instruction target matching "[xX][mM][lL]" is not allowed.; targetException=org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 6;
The processing instruction target matching "[xX][mM][lL]" is not allowed.]
I tested with SOAP UI, and it works, no error.
I even tested with apache axis2, but fails, too.
the problem is that the response from the php script seems to be invalid.
I looked at the encoding etc, checked if there is a new line or whatever. But I have no clue what the problem could be.
Sample soap call which works in Soap UI:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:searchQuery xmlns:ns1="http://localhost/Server.php" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<query xsi:type="xsd:string">oil</query>
</ns1:searchQuery>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response: When I click on validate in Soap UI, it tells me that the xml declration is not well formed. But I have no idea how to change it.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/Server.php" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><ns1:searchQueryResponse><return xsi:type="xsd:string">{
"prefixes": ..... }
</return></ns1:searchQueryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
The php Code I use to initialize the soap server:
try {
ini_set ( "soap.wsdl_cache_enabled", "0" );
$server = new SOAPServer ( 'Server.wsdl' );
$server->setClass ( 'Webdienst' );
$server->handle ();
}
catch ( SOAPFault $f ) {
echo $f->getMessage ();
}
My wsdl file:
<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost/Server.php" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Webdienst" targetNamespace="http://localhost/Server.php">
<types>
<xsd:schema targetNamespace="http://localhost/Server.php">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
</xsd:schema>
</types>
<portType name="WebdienstPort">
<operation name="createRecord">
<documentation>Create a new record</documentation>
<input message="tns:createRecordIn"/>
<output message="tns:createRecordOut"/>
</operation>
<operation name="searchQuery">
<documentation>Search for the String</documentation>
<input message="tns:searchQueryIn"/>
<output message="tns:searchQueryOut"/>
</operation>
</portType>
<binding name="WebdienstBinding" type="tns:WebdienstPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="createRecord">
<soap:operation soapAction="http://localhost/Server.php#createRecord"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</output>
</operation>
<operation name="searchQuery">
<soap:operation soapAction="http://localhost/Server.php#searchQuery"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Server.php"/>
</output>
</operation>
</binding>
<service name="WebdienstService">
<port name="WebdienstPort" binding="tns:WebdienstBinding">
<soap:address location="http://localhost/Server.php"/>
</port>
</service>
<message name="createRecordIn">
<part name="recordURI" type="xsd:anyType"/>
<part name="documentURI" type="xsd:anyType"/>
<part name="content" type="xsd:anyType"/>
<part name="fileName" type="xsd:anyType"/>
<part name="mimeType" type="xsd:anyType"/>
<part name="creationDate" type="xsd:anyType"/>
<part name="datasetURI" type="xsd:anyType"/>
<part name="translatedContent" type="xsd:anyType"/>
<part name="alchemyTopics" type="xsd:anyType"/>
<part name="summary" type="xsd:anyType"/>
<part name="author" type="xsd:anyType"/>
</message>
<message name="createRecordOut">
<part name="return" type="xsd:string"/>
</message>
<message name="searchQueryIn">
<part name="query" type="xsd:anyType"/>
</message>
<message name="searchQueryOut">
<part name="return" type="xsd:string"/>
</message>
</definitions>
I found the solution after googling around.
The problem was that I had an include() declaration at top of my soap server class which included another php file. The other php file had an empty line after the ?> closing tag. I moved the closing tag directly after the last brace and now it works!

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