I have two different WSDL's for same process. First one is giving three packages on wsimport while seconds one is giving two packages on wsimport. I think both of the wsdl are from different versions but I am sure that both have same functionality.
The first one with three packages is working fine for me but second one is giving error i. e SOAP error given in image. I have searched and worked every possibility but still I am standing at the same issue. Do anyone know what will be the working solution ?
First wsdl
<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.3.0-b170407.2038 svn-revision#2eaca54d17a59d265c6fe886b7fd0027836c766c.
-->
- <wsdl:definitions xmlns:tns="http://ouaf.oracle.com/webservices/c1/C1-AccountMail" xmlns:ouaf="http://ouaf.oracle.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="C1-AccountMail" targetNamespace="http://ouaf.oracle.com/webservices/c1/C1-AccountMail" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsp:UsingPolicy wssutil:Required="true" />
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ouaf="http://ouaf.oracle.com/" targetNamespace="http://ouaf.oracle.com/" elementFormDefault="unqualified">
- <xsd:element name="Fault">
- <xsd:complexType>
- <xsd:all>
<xsd:element name="ResponseStatus" type="xsd:string" />
<xsd:element name="ResponseCode" type="xsd:int" />
<xsd:element name="ResponseText" type="xsd:string" />
- <xsd:element name="ResponseData" minOccurs="0">
- <xsd:complexType>
<xsd:attribute name="parm1" type="xsd:string" />
<xsd:attribute name="parm2" type="xsd:string" />
<xsd:attribute name="parm3" type="xsd:string" />
<xsd:attribute name="parm4" type="xsd:string" />
<xsd:attribute name="parm5" type="xsd:string" />
<xsd:attribute name="parm6" type="xsd:string" />
<xsd:attribute name="parm7" type="xsd:string" />
<xsd:attribute name="parm8" type="xsd:string" />
<xsd:attribute name="parm9" type="xsd:string" />
<xsd:attribute name="text" type="xsd:string" />
<xsd:attribute name="category" type="xsd:string" />
<xsd:attribute name="numParm" type="xsd:int" />
<xsd:attribute name="number" type="xsd:int" />
</xsd:complexType>
</xsd:element>
- <xsd:element name="ServerMessage" minOccurs="0">
- <xsd:complexType>
- <xsd:all>
<xsd:element name="Category" type="xsd:string" />
<xsd:element name="Number" type="xsd:string" />
<xsd:element name="CallSequence" type="xsd:string" />
<xsd:element name="ProgramName" type="xsd:string" />
<xsd:element name="Text" type="xsd:string" />
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Table" type="xsd:string" />
<xsd:element name="Field" type="xsd:string" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
- <xsd:simpleType name="money">
<xsd:restriction base="xsd:decimal" />
</xsd:simpleType>
- <xsd:simpleType name="listAction">
- <xsd:restriction base="xsd:token">
<xsd:enumeration value="delete" />
<xsd:enumeration value="add" />
<xsd:enumeration value="update" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ouaf="http://ouaf.oracle.com/" targetNamespace="http://ouaf.oracle.com/webservices/c1/C1-AccountMail" elementFormDefault="qualified">
<xsd:import namespace="http://ouaf.oracle.com/" />
- <xsd:element name="C1-AccountMail">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="accountId" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="65536" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="results" minOccurs="0" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="premise" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="4000" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
- <xsd:element name="premiseInfo" minOccurs="0">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="4000" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="action" type="ouaf:listAction" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <!-- wsdl:message elements describe potential transactions -->
- <!-- request for operation C1-AccountMail -->
- <wsdl:message name="C1-AccountMailRequest">
<wsdl:part name="body" element="tns:C1-AccountMail" />
</wsdl:message>
- <!-- response for operation C1-AccountMail -->
- <wsdl:message name="C1-AccountMailResponse">
<wsdl:part name="body" element="tns:C1-AccountMail" />
</wsdl:message>
- <!-- fault type -->
- <wsdl:message name="Fault">
<wsdl:part name="fault" element="ouaf:Fault" />
</wsdl:message>
- <!-- wsdl:portType describes messages in an operation -->
- <wsdl:portType name="C1-AccountMailPortType">
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
- <wsdl:operation name="C1-AccountMail">
<wsdl:input message="tns:C1-AccountMailRequest" />
<wsdl:output message="tns:C1-AccountMailResponse" />
<wsdl:fault name="fault" message="tns:Fault" />
</wsdl:operation>
</wsdl:portType>
- <!-- wsdl:binding states a serialization protocol for this service -->
- <wsdl:binding name="C1-AccountMailSoapBinding" type="tns:C1-AccountMailPortType">
<wsp:PolicyReference URI="policy:Wssp1.2-2007-Https-BasicAuth.xml" />
- <!-- leverage off soap:binding document style ###(no wsdl:foo pointing at
the soap binding) -->
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <!-- semi-opaque container of network transport details classed by
soap:binding above ### -->
- <wsdl:operation name="C1-AccountMail">
- <!-- again bind to SOAP? ### -->
<soap:operation soapAction="http://10.1.5.86:6500/webservices/C1-AccountMail#C1-AccountMail" />
- <!-- further specify that the messages in the wsdl:operation
"C1-AccountMail" use SOAP? ### -->
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
+ <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
- <wsdl:fault name="fault">
<soap:fault name="fault" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
- <!-- wsdl:service names a new service "C1-AccountMailService" -->
+ <wsdl:service name="C1-AccountMailService">
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
- <!-- connect it to the binding "C1-AccountMailSoapBinding" above -->
- <wsdl:port name="C1-AccountMailPort" binding="tns:C1-AccountMailSoapBinding">
- <!-- give the binding a network address -->
<soap:address location="http://10.1.5.86:6500/ouaf/webservices/C1-AccountMail" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Second WSDL
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.3.0-b170407.2038 svn-revision#2eaca54d17a59d265c6fe886b7fd0027836c766c. -->
<wsdl:definitions xmlns:tns="http://ouaf.oracle.com/webservices/c1/C1-AccountMail" xmlns:ouaf="http://ouaf.oracle.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" name="C1-AccountMail" targetNamespace="http://ouaf.oracle.com/webservices/c1/C1-AccountMail">
<wsp:UsingPolicy wssutil:Required="true"/>
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ouaf="http://ouaf.oracle.com/" targetNamespace="http://ouaf.oracle.com/" elementFormDefault="unqualified">
<xsd:element name="Fault">
<xsd:complexType>
<xsd:all>
<xsd:element name="ResponseStatus" type="xsd:string"/>
<xsd:element name="ResponseCode" type="xsd:int"/>
<xsd:element name="ResponseText" type="xsd:string"/>
<xsd:element name="ResponseData" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="parm1" type="xsd:string"/>
<xsd:attribute name="parm2" type="xsd:string"/>
<xsd:attribute name="parm3" type="xsd:string"/>
<xsd:attribute name="parm4" type="xsd:string"/>
<xsd:attribute name="parm5" type="xsd:string"/>
<xsd:attribute name="parm6" type="xsd:string"/>
<xsd:attribute name="parm7" type="xsd:string"/>
<xsd:attribute name="parm8" type="xsd:string"/>
<xsd:attribute name="parm9" type="xsd:string"/>
<xsd:attribute name="text" type="xsd:string"/>
<xsd:attribute name="category" type="xsd:string"/>
<xsd:attribute name="numParm" type="xsd:int"/>
<xsd:attribute name="number" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="ServerMessage" minOccurs="0">
<xsd:complexType>
<xsd:all>
<xsd:element name="Category" type="xsd:string"/>
<xsd:element name="Number" type="xsd:string"/>
<xsd:element name="CallSequence" type="xsd:string"/>
<xsd:element name="ProgramName" type="xsd:string"/>
<xsd:element name="Text" type="xsd:string"/>
<xsd:element name="Description" type="xsd:string"/>
<xsd:element name="Table" type="xsd:string"/>
<xsd:element name="Field" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="money">
<xsd:restriction base="xsd:decimal"/>
</xsd:simpleType>
<xsd:simpleType name="listAction">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="delete"/>
<xsd:enumeration value="add"/>
<xsd:enumeration value="update"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ouaf="http://ouaf.oracle.com/" targetNamespace="http://ouaf.oracle.com/webservices/c1/C1-AccountMail" elementFormDefault="qualified">
<xsd:import namespace="http://ouaf.oracle.com/"/>
<xsd:element name="C1-AccountMail">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="accountId" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="65536"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="results" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="premise" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="premiseInfo" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="action" type="ouaf:listAction"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<!-- wsdl:message elements describe potential transactions -->
<!-- request for operation C1-AccountMail -->
<wsdl:message name="C1-AccountMailRequest">
<wsdl:part name="body" element="tns:C1-AccountMail"/>
</wsdl:message>
<!-- response for operation C1-AccountMail -->
<wsdl:message name="C1-AccountMailResponse">
<wsdl:part name="body" element="tns:C1-AccountMail"/>
</wsdl:message>
<!-- fault type -->
<wsdl:message name="Fault">
<wsdl:part name="fault" element="ouaf:Fault"/>
</wsdl:message>
<!-- wsdl:portType describes messages in an operation -->
<wsdl:portType name="C1-AccountMailPortType">
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
<wsdl:operation name="C1-AccountMail">
<wsdl:input message="tns:C1-AccountMailRequest"/>
<wsdl:output message="tns:C1-AccountMailResponse"/>
<wsdl:fault name="fault" message="tns:Fault"/>
</wsdl:operation>
</wsdl:portType>
<!-- wsdl:binding states a serialization protocol for this service -->
<wsdl:binding name="C1-AccountMailSoapBinding" type="tns:C1-AccountMailPortType">
<wsp:PolicyReference URI="policy:Wssp1.2-2007-Https-BasicAuth.xml"/>
<!-- leverage off soap:binding document style ###(no wsdl:foo pointing at
the soap binding) -->
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<!-- semi-opaque container of network transport details classed by
soap:binding above ### -->
<wsdl:operation name="C1-AccountMail">
<!-- again bind to SOAP? ### -->
<soap:operation soapAction="http://CIS17/webservices/C1-AccountMail#C1-AccountMail"/>
<!-- further specify that the messages in the wsdl:operation
"C1-AccountMail" use SOAP? ### -->
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="fault">
<soap:fault name="fault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<!-- wsdl:service names a new service "C1-AccountMailService" -->
<wsdl:service name="C1-AccountMailService">
<wsdl:documentation>C1-AccountMail version 1: Retrieve an Account's Mailing Address</wsdl:documentation>
<!-- connect it to the binding "C1-AccountMailSoapBinding" above -->
<wsdl:port name="C1-AccountMailPort" binding="tns:C1-AccountMailSoapBinding">
<!-- give the binding a network address -->
<soap:address location="http://10.1.5.95:6500/ouaf/webservices/C1-AccountMail"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Related
I am trying to create a client to send a SOAP request with spring boot to the wsdl defined bellow:
<?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:ATMWebSvr" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:ATMWebSvr">
<types>
<xsd:schema targetNamespace="urn:ATMWebSvr"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="ErroProcesso">
<xsd:sequence>
<xsd:element name="Codigo" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Descricao" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="ValorEsperado" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="ValorInformado" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ErrosProcesso">
<xsd:sequence>
<xsd:element name="Erro" type="tns:ErroProcesso" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DadosSeguro">
<xsd:sequence>
<xsd:element name="NumeroAverbacao" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="CNPJSeguradora" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="NomeSeguradora" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="NumApolice" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="TpMov" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="TpDDR" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="ValorAverbado" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="RamoAverbado" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SuccessProcesso">
<xsd:sequence>
<xsd:element name="dhAverbacao" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Protocolo" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="DadosSeguro" type="tns:DadosSeguro" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SuccessProcessoMDFe">
<xsd:sequence>
<xsd:element name="dhChancela" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Protocolo" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="InfoProcesso">
<xsd:sequence>
<xsd:element name="Codigo" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Descricao" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="InfosProcesso">
<xsd:sequence>
<xsd:element name="Info" type="tns:InfoProcesso" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Retorno">
<xsd:sequence>
<xsd:element name="Numero" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Serie" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Filial" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="CNPJCli" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="TpDoc" type="xsd:integer" minOccurs="0" maxOccurs="1"/>
<xsd:element name="InfAdic" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Erros" type="tns:ErrosProcesso" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Averbado" type="tns:SuccessProcesso" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Infos" type="tns:InfosProcesso" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="RetornoMDFe">
<xsd:sequence>
<xsd:element name="Numero" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Serie" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Filial" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="Erros" type="tns:ErrosProcesso" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Declarado" type="tns:SuccessProcessoMDFe" minOccurs="0" maxOccurs="1"/>
<xsd:element name="Infos" type="tns:InfosProcesso" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="averbaCTeRequest">
<part name="usuario" type="xsd:string" />
<part name="senha" type="xsd:string" />
<part name="codatm" type="xsd:string" />
<part name="xmlCTe" type="xsd:string" /></message>
<message name="averbaCTeResponse">
<part name="Response" type="tns:Retorno" /></message>
<message name="averbaNFeRequest">
<part name="usuario" type="xsd:string" />
<part name="senha" type="xsd:string" />
<part name="codatm" type="xsd:string" />
<part name="xmlNFe" type="xsd:string" /></message>
<message name="averbaNFeResponse">
<part name="Response" type="tns:Retorno" /></message>
<message name="declaraMDFeRequest">
<part name="usuario" type="xsd:string" />
<part name="senha" type="xsd:string" />
<part name="codatm" type="xsd:string" />
<part name="xmlMDFe" type="xsd:string" /></message>
<message name="declaraMDFeResponse">
<part name="Response" type="tns:RetornoMDFe" /></message>
<message name="AddBackMailRequest">
<part name="usuario" type="xsd:string" />
<part name="senha" type="xsd:string" />
<part name="codatm" type="xsd:string" />
<part name="aplicacao" type="xsd:string" />
<part name="assunto" type="xsd:string" />
<part name="remetentes" type="xsd:string" />
<part name="destinatarios" type="xsd:string" />
<part name="corpo" type="xsd:string" />
<part name="chave" type="xsd:string" />
<part name="chaveresp" type="xsd:string" /></message>
<message name="AddBackMailResponse">
<part name="return" type="xsd:string" /></message>
<portType name="ATMWebSvrPortType">
<operation name="averbaCTe">
<documentation>Interface de averbação eletrônica AT&M para CTe</documentation>
<input message="tns:averbaCTeRequest"/>
<output message="tns:averbaCTeResponse"/>
</operation>
<operation name="averbaNFe">
<documentation>Interface de averbação eletrônica AT&M para NFe</documentation>
<input message="tns:averbaNFeRequest"/>
<output message="tns:averbaNFeResponse"/>
</operation>
<operation name="declaraMDFe">
<documentation>Interface de declaração do MDFe para AT&M</documentation>
<input message="tns:declaraMDFeRequest"/>
<output message="tns:declaraMDFeResponse"/>
</operation>
<operation name="AddBackMail">
<documentation>Serviço de envio de emails para aplicações automatizadas</documentation>
<input message="tns:AddBackMailRequest"/>
<output message="tns:AddBackMailResponse"/>
</operation>
</portType>
<binding name="ATMWebSvrBinding" type="tns:ATMWebSvrPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="averbaCTe">
<soap:operation soapAction="urn:ATMWebSvr#averbaCTe" style="rpc"/>
<input><soap:body use="literal" namespace="urn:ATMWebSvr"/></input>
<output><soap:body use="literal" namespace="urn:ATMWebSvr"/></output>
</operation>
<operation name="averbaNFe">
<soap:operation soapAction="urn:ATMWebSvr#averbaNFe" style="rpc"/>
<input><soap:body use="literal" namespace="urn:ATMWebSvr"/></input>
<output><soap:body use="literal" namespace="urn:ATMWebSvr"/></output>
</operation>
<operation name="declaraMDFe">
<soap:operation soapAction="urn:ATMWebSvr#declaraMDFe" style="rpc"/>
<input><soap:body use="literal" namespace="urn:ATMWebSvr"/></input>
<output><soap:body use="literal" namespace="urn:ATMWebSvr"/></output>
</operation>
<operation name="AddBackMail">
<soap:operation soapAction="urn:ATMWebSvr#AddBackMail" style="rpc"/>
<input><soap:body use="literal" namespace="urn:ATMWebSvr"/></input>
<output><soap:body use="literal" namespace="urn:ATMWebSvr"/></output>
</operation>
</binding>
<service name="ATMWebSvr">
<port name="ATMWebSvrPort" binding="tns:ATMWebSvrBinding">
<soap:address location="http://webserver.averba.com.br/20/index.soap"/>
</port>
</service>
</definitions>
The thing is, when I generate the classes using JAXB there is not bean for the request objects (I am trying to use the averbaCTeRequest). Now, using soapUI I can use the service normally, I am just having a hard time to code this in spring boot. Should I not be using objects? Should I be building this message differently? And on top of that, how do I specify the action "averbaCte" on my request?.
#Configuration
public class AtmIntegracaoConfiguration {
#Value("${atm.url}")
private String url;
#Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("atm.wsdl");
return marshaller;
}
#Bean
public AtmIntegracaoClient atmIntegracaoClient(Jaxb2Marshaller marshaller) {
AtmIntegracaoClient client = new AtmIntegracaoClient();
client.setDefaultUri(url);
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}
public class AtmIntegracaoClient extends WebServiceGatewaySupport {
private static final Logger log = LoggerFactory.getLogger(AtmIntegracaoClient.class);
#Value("${atm.usuario}")
private String usuario;
#Value("${atm.senha}")
private String senha;
#Value("${atm.codatm}")
private String codatm;
#Value("${atm.url}")
private String url;
public Retorno averbaCte(String cteXmlStr) {
Retorno response = (Retorno) getWebServiceTemplate()
.marshalSendAndReceive("http://homologaws.averba.com.br/20/index.soap", request,
new SoapActionCallback(
"http://localhost:8080/ATMWebSvr/averbaCTe"));
return response;
}
}
Found the solution. The problem was that this SOAP service is RPC style and I am guessing a bit old. The trick for me was instead of using JAXb to use wsimport.
Just run:
wsimport -keep {wsdl url}
It will generate the objects, an interface for the service and a service implementation.
I'm currently updating a old axis wsclient to a cxf(jaxb databinding) client,
now there are differences, how list/array are handled.
Let me explain that on an example:
wsdl
<xsd:complexType name="ArrayOfString">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="string" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
which is in a other complexType
<xsd:complexType name="CustomParameter">
<xsd:sequence>
<xsd:element minOccurs="0" name="values" nillable="true" type="tns:ArrayOfString"/>
</xsd:sequence>
</xsd:complexType>
now when trying to access this attribute in cxf it is needed to additionally get the value from the list-wrapper
CustomParameter.getValues().getString(); // returns List<String>
Axis does afaik unwrap this automatically that you got the array only with
CustomParameter.getValues() // returns String[]
My question is, is this possible to do this in cxf?
A part of my wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws611.webservice.adapters.company.de" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws611.webservice.adapters.company.de" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://usermanagement.ws611.webservice.company.de"
xmlns:ns1="http://ws611.webservice.company.de" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws611.webservice.company.de">
<xsd:complexType name="AuthenticationToken">
<xsd:sequence>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="timestamp" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="username" nillable="true" type="xsd:string"/>
</xsd:sequence>
<xsd:anyAttribute/>
</xsd:complexType>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws611.webservice.adapters.company.de">
<xsd:element name="getAllUsers">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="ns1:AuthenticationToken"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getAllUsersResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="ns2:ArrayOfUser"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://usermanagement.ws611.webservice.company.de">
<xsd:complexType name="ArrayOfUser">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="User" nillable="true" type="ns2:User"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="User">
<xsd:sequence>
<xsd:element minOccurs="0" name="name" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="groups" nillable="true" type="ns2:ArrayOfGroup"/>
</xsd:sequence>
<xsd:anyAttribute/>
</xsd:complexType>
<xsd:complexType name="ArrayOfGroup">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Group" nillable="true" type="ns2:Group"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Group">
<xsd:sequence>
<xsd:element minOccurs="0" name="name" nillable="true" type="xsd:string"/>
</xsd:sequence>
<xsd:anyAttribute/>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getAllUsersRequest">
<wsdl:part name="parameters" element="tns:getAllUsers">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getAllUsersResponse">
<wsdl:part name="parameters" element="tns:getAllUsersResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="UserManagementPortType">
<wsdl:operation name="getAllUsers">
<wsdl:input name="getAllUsersRequest" message="tns:getAllUsersRequest">
</wsdl:input>
<wsdl:output name="getAllUsersResponse" message="tns:getAllUsersResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserManagementHttpBinding" type="tns:UserManagementPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getAllUsers">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getAllUsersRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAllUsersResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UserManagement">
<wsdl:port name="UserManagementHttpPort" binding="tns:UserManagementHttpBinding">
<wsdlsoap:address location="http://localhost:8080/test/webservice/ws611/UserManagement"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
It is possible to get the cxf-codegen-plugin to generate model classes that automatically hide XML element wrapper classes.
There are three things you need to use:
A custom JAXB binding file that suppresses usage of JAXBElement
For any PortTypes, a custom JAXWS binding file that makes sure to use your request and response classes directly
The jaxb-xew-plugin to generate #XmlElementWrapper annotations, which is the JAXB annotation for designating lists as wrapped
Here is what the custom JAXB binding file should look like:
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
Here is what the custom JAXWS binding file should look like:
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>
Here is a sample working usage of the cxf-codegen-plugin using JAXB and JAXWS binding files and the jaxb-xew-plugin:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.4</version>
<executions>
<execution>
<id>generate-client</id>
<phase>generate-sources</phase>
<configuration>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/sample.wsdl</wsdl>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/jaxbBinding.xml</bindingFile>
<bindingFile>${basedir}/src/main/resources/jaxwsBinding.xml</bindingFile>
</bindingFiles>
<extraargs>
<extraarg>-xjc-Xxew</extraarg>
<extraarg>-xjc-Xxew:summary
${project.build.outputDirectory}/../xew-summary.txt
</extraarg>
<extraarg>-xjc-Xxew:instantiate lazy</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.jaxb-xew-plugin</groupId>
<artifactId>jaxb-xew-plugin</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2.11</version>
</dependency>
</dependencies>
</plugin>
This configuration will generate the following on the schema provided in the question:
CustomParameter.getValues() // returns List<String>
Note that this does NOT return a String[]. You could get the cxf-codegen-plugin to use a String[] instead of a List<String> by adding a collectionType="indexed" attribute to your globalBindings, but currently the jaxb-xew-plugin only supports Collection types and not arrays.
The error when validated using SAX parser is:
"org.xml.sax.SAXParseException; systemId: file:///home/samitha/svnrepo/XML/XML_XSDValidator/src/address.xsd; lineNumber: 10; columnNumber: 31; src-resolve.4.1: Error resolving component 'name'.
It was detected that 'name' has no namespace, but components with no target namespace are not referenceable from schema document 'file:///home/samitha/svnrepo/XML/XML_XSDValidator/src/address.xsd'.
If 'name' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'name' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:///home/samitha/svnrepo/XML/XML_XSDValidator/src/address.xsd'."
address.xml
<?xml version ="1.0" encoding="UTF-8"?>
<address
xmlns:personal="Personal things"
xmlns:houses="Regarding to houses"
xmlns="http://www.w3schools.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:schemaLocation="address.xsd"
>
<name>
<personal:title>Mr.</personal:title>
<first-name>Samitha</first-name>
<last-name>Chathuranga</last-name>
</name>
<sssd></sssd>
<house-id>
<houses:title>107 B</houses:title>
<NAME>Sam's Home</NAME>
<!-- An intnal entity is used for the single quote in House Name here-->
</house-id>
<village>Poramba</village>
<city district="Galle" province="Southern">AG</city>
<postal-code>80300</postal-code>
<country>Sri Lanka</country>
</address>
address.xsd
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/SampleSchema"
xmlns:tns="http://www.example.org/SampleSchema"
>
<xsd:element name="address">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="name" />
<xsd:element ref="house-id" />
<xsd:element ref="village" />
<xsd:element ref="city" />
<xsd:element ref="postal-code" />
<xsd:element ref="country" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="name">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="title" />
<xsd:element ref="first-name" />
<xsd:element ref="last-name" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="first-name" type="xsd:string" />
<xsd:element name="last-name" type="xsd:string" />
<xsd:element name="house-id">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="title" />
<xsd:element ref="NAME" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="NAME" type="xsd:string" />
<xsd:element name="village" type="xsd:string" />
<xsd:element name="country" type="xsd:string" />
<xsd:element name="city">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:length value="2" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="postal-code">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{5}(-[0-9]{4})?" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
How to resolve this error?
Well your xsd is invalid. You are constructing it wrong. Here are my suggestions. Download XMLSpy or Liquid XML studio and then view my examples to see how to construct a proper XSD and then validate the XSD against it. These editors are a great way to visually see the XML documents and xsd's. They will help a lot.
Essentially you need to declare your types in the XSD then create elements based on those types. While your approach can work I would suggest that you study the approach I have taken it is pretty easy. I could explain it all but I think you will get the idea rather quickly.
Address.xsd
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML 2013 Designer Edition 11.1.0.4725 (http://www.liquid-technologies.com)-->
<xsd:schema xmlns:address="http://www.example.org/AddressSchema"
targetNamespace="http://www.example.org/AddressSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="address">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="person_name"
type="address:person_name_type" />
<xsd:element name="ssd"
type="address:ssd_type" />
<xsd:element name="house_id"
type="address:house_id_type" />
<xsd:element name="village"
type="address:village_type" />
<xsd:element name="city"
type="address:city_type" />
<xsd:element name="postal_code"
type="address:postalcode_type" />
<xsd:element name="country"
type="address:country_type" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="name_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="postalcode_type">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{5}(-[0-9]{4})?" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="city_type">
<xsd:restriction base="xsd:string">
<xsd:length value="2" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="village_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="country_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="title_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="first_name_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="last_name_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:complexType name="house_id_type">
<xsd:sequence>
<xsd:element name="title"
type="address:title_type" />
<xsd:element name="name"
type="address:name_type" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="person_name_type">
<xsd:sequence>
<xsd:element name="title"
type="address:title_type" />
<xsd:element name="first_name"
type="address:first_name_type" />
<xsd:element name="last_name"
type="address:last_name_type" />
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="ssd_type">
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
</xsd:schema>
Address.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid XML 2013 Designer Edition 11.1.0.4725 (http://www.liquid-technologies.com) -->
<address xsi:schemaLocation="http://www.example.org/AddressSchema D:\GroundZero\address.xsd" xmlns="http://www.example.org/AddressSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<person_name>
<title>string</title>
<first_name>string</first_name>
<last_name>string</last_name>
</person_name>
<ssd>string</ssd>
<house_id>
<title>string</title>
<name>string</name>
</house_id>
<village>string</village>
<city>AB</city>
<postal_code>80300</postal_code>
<country>string</country>
</address>
I would also note that your instance document has the root (address) element in namespace http://www.w3schools.com, while your schema defines an address element in namespace http://www.example.org/AddressSchema. You can't just sprinkle namespaces around like fairy-dust and hope they add glamour to your code; they are fundamental and you need to get them right.
I have a WSDL document:
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://java.CAEServer"
xmlns:server="http://caeserver.caebeans.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://java.CAEServer"
name="CAEInstanceImplService">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://caeserver.caebeans.org"
xmlns:test="http://example.org"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:serv="http://caeserver.caebeans.org"
attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:element name="data" type="xsd:string"/>
<xsd:element name="parameter">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="text">
<xsd:complexType>
<xsd:attribute name="data" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="units">
<xsd:complexType>
<xsd:attribute name="data" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="comment">
<xsd:complexType>
<xsd:attribute name="data" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="enums" type="xsd:string"/>
<xsd:element name="default" type="xsd:int"/>
<xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="visible" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="languageData">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:element name="language">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="data" type="serv:languageData"/>
</xsd:sequence>
<!--<xsd:attribute name="xml:lang" type="xsd:string"/>-->
</xsd:complexType>
</xsd:element>
<xsd:element name="instance_ID" type="xsd:string"/>
<xsd:element name="problemCaebean">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="categories">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="category">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" ref="serv:parameter"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="data" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="resources">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" ref="serv:language"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="author" type="xsd:string"/>
<xsd:attribute name="version" type="xsd:decimal"/>
<xsd:attribute name="caebeanId" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="caeProject">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="serv:problemCaebean"/>
<xsd:element name="logical">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="node">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="condition" type="xsd:string"/>
<xsd:attribute name="execute" type="xsd:string"/>
<xsd:attribute name="x" type="xsd:int"/>
<xsd:attribute name="y" type="xsd:int"/>
</xsd:complexType>
</xsd:element>
<xsd:element maxOccurs="unbounded" name="edge">
<xsd:complexType>
<xsd:attribute name="source" type="xsd:string"/>
<xsd:attribute name="target" type="xsd:string"/>
<xsd:attribute name="when" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="physical">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="componentCaebean">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="input">
<xsd:complexType>
<xsd:attribute name="filename" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element maxOccurs="unbounded" name="output">
<xsd:complexType>
<xsd:attribute name="filename" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="jar-premode">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="exec">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="param">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="appname" type="xsd:string"/>
<xsd:attribute name="appversion" type="xsd:decimal"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="author" type="xsd:string"/>
<xsd:attribute name="version" type="xsd:decimal"/>
<xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Status">
<xsd:complexType>
<xsd:choice>
<xsd:element name="NOT_STARTED"/>
<xsd:element name="RUNNING"/>
<xsd:element name="HELD"/>
<xsd:element name="SUCCESSFULL"/>
<xsd:element name="FAILED"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="CurrentTime">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:dateTime">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="TerminationTime" nillable="true">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:dateTime">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Description">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="serv:Status"/>
<xsd:element ref="serv:TerminationTime"/>
<xsd:element ref="serv:CurrentTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!--
message used to create a new instance WS-Resource
-->
<xsd:element name="createInstance">
<xsd:complexType/>
</xsd:element>
<!--
the response, simply contains an EPR to the new instance
-->
<xsd:element name="createInstanceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="instanceID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="submitJob">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="serv:instance_ID"/>
<xsd:element ref="serv:problemCaebean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="submitJobResponse">
<xsd:complexType>
<xsd:sequence>
<!--<xsd:element name="xml" type="xsd:string"/>-->
<xsd:element name="Result" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getStatus">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="instance_ID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getStatusResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="serv:Status"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="SubmitJobRequest">
<part name="parameter" element="server:submitJob"/>
</message>
<message name="SubmitJobResponse">
<part name="parameter" element="server:submitJobResponse"/>
</message>
<message name="GetStatusRequest">
<part name="parameter" element="server:getStatus"/>
</message>
<message name="GetStatusResponse">
<part name="parameter" element="server:getStatusResponse"/>
</message>
<portType name="CAEInstance">
<operation name="SubmitJob">
<input message="tns:SubmitJobRequest"/>
<output message="tns:SubmitJobResponse"/>
</operation>
<operation name="GetStatus">
<input message="tns:GetStatusRequest"/>
<output message="tns:GetStatusResponse"/>
</operation>
</portType>
<binding name="CAEInstanceImplPortBinding" type="tns:CAEInstance">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="SubmitJob">
<soap:operation soapAction="http://java.CAEServer/submitJob"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="GetStatus">
<soap:operation soapAction="http://java.CAEServer/getStatus"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CAEInstanceImplService">
<port name="CAEInstanceImplPort" binding="tns:CAEInstanceImplPortBinding">
<soap:address location="http://127.0.0.1:9000/caeinstance"/>
</port>
</service>
</definitions>
And I'm creating types and services definitions with command
wsimport -keep -verbose ../src/main/resources/instance.wsdl
But when I compiled and runned my project and tryed to compile client stubs from generated WSDL, I've got an error
parsing WSDL...
[ERROR] undefined element declaration 'ns1:instance_ID'
line 36 of http://localhost:9000/caeinstance?xsd=1
[ERROR] undefined element declaration 'ns1:Result'
line 49 of http://localhost:9000/caeinstance?xsd=1
What's wrong with my WSDL?
CXF and Eclipse both supply WSDL validators. You should run your WSDL through one of those and see what it says.
Did you create that WSDL?
I think you are trying to use some data types which are not exported in your WSDL.
The wsdl refers to a schema named 's' but this can't be found, because its URL is
XMLSchema but should be
XMLSchema.xsd
U can use
wsimport -b http://www.w3.org/2001/XMLSchema.xsd usrtowsdl?WSDL
I have written a WSDL to generate the Stubs and skeleton but my skeletons are not getting generated in the eclipse. I am using Helios version of Eclipse.
Can any one tell what is the issue with WSDL?
I want to use Axis 2. I tried to generate the skeleton using wsdl2java also but it gives compilation issues in the generated classes. I am not able to attach the file here so I am pasting it here.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:impl="http://DefaultNamespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="Test" targetNamespace="http://DefaultNamespace">
<wsdl:types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://DefaultNamespace" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xml.apache.org/xml-soap" />
<xsd:element name="serviceMethod">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="vo" type="impl:MyVo" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="MyVo">
<xsd:sequence>
<xsd:element name="name" nillable="false" type="xsd:string" />
<xsd:element name="params" nillable="true"
type="apachesoap:Map" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="serviceMethodResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="serviceMethodReturn" type="impl:MyVo" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://DefaultNamespace" />
<xsd:complexType name="mapItem">
<xsd:sequence>
<xsd:element name="key" nillable="true" type="xsd:anyType" />
<xsd:element name="value" nillable="true" type="xsd:anyType" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Map">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="item" type="apachesoap:mapItem" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="serviceMethodRequest">
<wsdl:part element="impl:serviceMethod" name="parameters" />
</wsdl:message>
<wsdl:message name="serviceMethodResponse">
<wsdl:part element="impl:serviceMethodResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="Test">
<wsdl:operation name="serviceMethod">
<wsdl:input message="impl:serviceMethodRequest" name="serviceMethodRequest" />
<wsdl:output message="impl:serviceMethodResponse" name="serviceMethodResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestSOAP" type="impl:Test">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="serviceMethod">
<soap:operation soapAction="http://DefaultNamespace/serviceMethod" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Test">
<wsdl:port binding="impl:TestSOAP" name="MyWebService">
<soap:address location="http://localhost:8080/Temp/services/MyService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
That's a problem with your install.
Download and verify axis2 and the axis2 eclipse plugins, make sure you've set up your AXIS2_HOME class paths.
Sometimes it stops working for me too, and then I have to go and reinstall everything. Don't bother making bug reports to Eclipse or Apache, they are always closed as "WORKSFORME".
Steps to produce code from your wsdl:
Create a dynamic web project.
Create your wsdl file.
Right-click on your wsdl file, select Web Services -> Generate Java Bean Skeleton
Click Finish
The Axis2 libraries, facets, and generated code will be added to your project automagically, and there will be no compilation problems.
I had the same problem. I believe maven folder structure is causing it. I created a new project without maven and it worked. Added maven later. Also check source folders at "Java Build Path". If it is missing you will need to add it.
I was facing the same trouble but now it has been solved. The problem is if you have a method that 'THROWS SOME KIND OF EXCEPTION', then it will cause the problem. Hence instead of throwing the error, try using try-catch block statement.