I am having troubles generating a WS from a WSDL by means of wsimport.
The WSDL is the TMDD v3.0 standard specification (WSDL and related XSD files can be found here)
According to this article from IBM the WSDL seems to be in Document/literal format.
In order to get the WSDL compiled I have created some bindings/tweaks however I am stuck at this error (it does not generate a method since the operation has more than one part):
[WARNING] Ingoring operation "DlFullEventUpdateSubscription": more than one part
bound to body
line 17 of file:/O:/temp/wsdltest/TMDD-stripped.wsdl
To simplify, this is the stripped down version of the WSDL with only the interesting operation definition
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:tns="http://www.tmdd.org/3/dialogs"
xmlns:tmdd="http://www.tmdd.org/3/messages" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:c2c="http://www.ntcip.org/c2c-message-administration" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="TMDDCenterServices" targetNamespace="http://www.tmdd.org/3/dialogs">
<documentation>
</documentation>
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.tmdd.org/3/messages"
schemaLocation="TMDD.xsd" />
<xs:import namespace="http://www.ntcip.org/c2c-message-administration"
schemaLocation="C2C.xsd" />
</xs:schema>
</types>
<message name="MSG_EventSubscription">
<part name="c2cMsgAdmin" element="c2c:c2cMessageSubscription" />
<part name="message" element="tmdd:eventRequestMsg" />
</message>
<!-- Common Messages -->
<message name="MSG_ConfirmationReceipt">
<!-- CONNECTION MANAGEMENT Messages -->
<part name="message" element="c2c:c2cMessageReceipt" />
</message>
<message name="MSG_ErrorReport">
<part name="message" element="tmdd:errorReportMsg" />
</message>
<!-- TMDD Owner Center Porttype -->
<portType name="tmddOCSoapHttpServicePortType">
<operation name="DlFullEventUpdateSubscription">
<documentation>
<objectClass>Event</objectClass>
<msgPattern>Sub</msgPattern>
<requirement>REQ1261</requirement>
</documentation>
<input message="tns:MSG_EventSubscription" />
<output message="tns:MSG_ConfirmationReceipt" />
<fault name="errorReport" message="tns:MSG_ErrorReport" />
</operation>
</portType>
<!-- TMDD Owner Center binding -->
<binding name="tmddOCSoapHttpServiceBinding" type="tns:tmddOCSoapHttpServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="DlFullEventUpdateSubscription">
<soap:operation soapAction="' '" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="errorReport">
<soap:fault name="errorReport" use="literal" />
</fault>
</operation>
</binding>
<!-- TMDD Owner Center Service -->
<service name="tmddOCSoapHttpService">
<!-- ************************ -->
<!-- OWNER CENTER Services -->
<!-- ************************ -->
<port name="tmddOCSoapHttpServicePort" binding="tns:tmddOCSoapHttpServiceBinding">
<soap:address location="http://tmdd.owner.center.com/c2cxml/" />
</port>
</service>
</definitions>
The bindings file:
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<!-- To create standalone classes instead of nested classes -->
<!--<globalBindings localScoping="toplevel"/>-->
<!--*****************-->
<!-- Package Binding -->
<!--*****************-->
<!--*****************************-->
<!-- C2C classes package binding -->
<!--*****************************-->
<bindings schemaLocation="C2C.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.ntcip.messageadministration" />
</schemaBindings>
</bindings>
<!--**************************************-->
<!-- ITIS-Adopted classes package binding -->
<!--**************************************-->
<bindings schemaLocation="ITIS-Adopted-03-00-02.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.itis.adopted" />
</schemaBindings>
</bindings>
<!--************************************-->
<!-- ITIS-Local classes package binding -->
<!--************************************-->
<bindings schemaLocation="ITIS-Local-03-00-02.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.itis.local" />
</schemaBindings>
</bindings>
<!--**************************************-->
<!-- LRMS-Adopted classes package binding -->
<!--************************************* -->
<bindings schemaLocation="LRMS-Adopted-02-00-00.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.lrms.adopted" />
</schemaBindings>
</bindings>
<!--************************************-->
<!-- LRMS-Local classes package binding -->
<!--************************************-->
<bindings schemaLocation="LRMS-Local-02-00-00.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.lrms.local" />
</schemaBindings>
</bindings>
<!--*******************************-->
<!-- NTCIP classes package binding -->
<!--*******************************-->
<bindings schemaLocation="NTCIP-References.xsd">
<schemaBindings>
<package name="tdf.tmdd.model.ntcip.objectreferences" />
</schemaBindings>
</bindings>
<!--******************************-->
<!-- TMDD classes package binding -->
<!--******************************-->
<bindings schemaLocation="TMDD.xsd">
<schemaBindings>
<package name="tdf.tmdd.model" />
</schemaBindings>
</bindings>
<!--***********************-->
<!-- Class personalization -->
<!--***********************-->
<!--************************************-->
<!-- LRMS-Adopted class personalization -->
<!--************************************-->
<bindings schemaLocation="LRMS-Adopted-02-00-00.xsd">
<bindings node="//xs:complexType[#name='Chain']//xs:sequence//xs:element[#name='chain']//xs:complexType">
<class name="ChainElement" />
</bindings>
<bindings node="//xs:complexType[#name='GridPointPair']">
<class name="GridPointPairAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='AreaLocation']">
<class name="AreaLocationAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='LinkLocation']">
<class name="LinkLocationAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='AdminAreaGroup']">
<class name="AdminAreaGroupAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='GridPointSequence']">
<class name="GridPointSequenceAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='Grid']">
<class name="GridAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='NodeAttribute']">
<class name="NodeAttributeAdopted" />
</bindings>
<bindings node="//xs:complexType[#name='GridPoint']">
<class name="GridPointAdopted" />
</bindings>
</bindings>
<!--********************************-->
<!-- factory method personalization -->
<!--********************************-->
<!--*************************************-->
<!-- TMDD factory method personalization -->
<!--*************************************-->
<bindings schemaLocation="TMDD.xsd" >
<bindings node="//xs:complexType[#name='IntersectionSignalInventoryLinkList']">
<factoryMethod name="createIntersectionSignalInventoryLinks" />
</bindings>
</bindings>
</bindings>
The command line to invoke wsimport is the following:
O:\temp\wsdltest>wsimport -extension -Xdebug -s src -b bindings.xjb TMDD-stripped.wsdl
What can I do to get the "DlFullEventUpdateSubscription" operation correctly created? Are there any alternatives to generate the Java web service? I can not modify the operation definition, since that would not comply with the standard.
Update. Solution
I managed to get it working by modifying WSDL so each part of the message is assigned to header and body:
<binding name="tmddOCSoapHttpServiceBinding" type="tns:tmddOCSoapHttpServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="DlFullEventUpdateSubscription">
<soap:operation soapAction="' '" style="document" />
<input>
<soap:header message="tns:MSG_EventSubscription" use="literal" part="c2cMsgAdmin"/>
<soap:body use="literal" parts="message"/>
</input>
<output>
<soap:body use="literal" />
</output>
<fault name="errorReport">
<soap:fault name="errorReport" use="literal" />
</fault>
</operation>
</binding>
Document-Literal cannot have multi-part message operations. You can use below alternatives.
Use Document/Literal Wrapped style - Wrap multiple parts in a single
document.
Use RPC/Literal style - No restrictions on binding multiple
parts in soap body.
Thanks,
Sreehari.
Related
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
I'm newbie with web services and java, so I have some issues to connect my application with an external Web Service. I get all the time this exception
The message with Action '' cannot be processed at the receiver
Maybe my assumptions are wrong, but I think the action is defined inside the SOAP payload. Here is the WSDL:
<?xml version='1.0'?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.tempuri.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tempuri.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types />
<message name="BINICIARREPORTRequest">
<part name="EAUSUARIO" type="xsd:string" />
<part name="EAMODULO" type="xsd:string" />
<part name="EANOMREPOR" type="xsd:string" />
<part name="EAPARAMREPOR" type="xsd:string" />
<part name="EANOMPANTA" type="xsd:string" />
</message>
<message name="BINICIARREPORTResponse">
<part name="RESULT" type="xsd:boolean" />
</message>
<portType name="PWS_LANZA_REPOR_PORT_1">
<operation name="BINICIARREPORT">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<input message="tns:BINICIARREPORTRequest" />
<output message="tns:BINICIARREPORTResponse" />
</operation>
</portType>
<binding name="PWS_LANZA_REPOR_PORT_1Soap" type="tns:PWS_LANZA_REPOR_PORT_1">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<operation name="BINICIARREPORT">
<soap:operation soapAction="http://www.tempuri.org/wsdl/BINICIARREPORTRequest" style="rpc" />
<input name="BINICIARREPORTRequest">
<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output name="BINICIARREPORTResponse">
<soap:body use="encoded" namespace="http://www.tempuri.org/wsdl/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="PWS_LANZA_REPOR">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<port name="PWS_LANZA_REPOR_PORT_1Port" binding="tns:PWS_LANZA_REPOR_PORT_1Soap">
<soap:address location="" />
</port>
</service>
</definitions>
Here is the code I'm using:
final String endpointUrl = this.configuracion
.getConfigJNDI(WS_MECANIZACION_JNDI);
final QName serviceName = new QName(null,
"PWS_LANZA_REPOR");
final QName portName = new QName(null, "PWS_LANZA_REPOR_PORT_1Port");
final javax.xml.ws.Service service = javax.xml.ws.Service
.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
endpointUrl);
final Dispatch<SOAPMessage> dispatch = service.createDispatch(
portName, SOAPMessage.class,
javax.xml.ws.Service.Mode.MESSAGE);
final SOAPMessage response = dispatch.invoke(mensajeSOAP);
If I use SoapUI to check this out, everything works fine (the message is OK as well as the endpointURL), but no success whatsoever from the java application.
This is the soap message I'm sending:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="s" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<wsdl:BINICIARREPORT xmlns:wsdl="cosa">
<EAUSUARIO>CD</EAUSUARIO>
<EAMODULO>PR</EAMODULO>
<EANOMREPOR>PRR14</EANOMREPOR>
<EAPARAMREPOR/>
<EANOMPANTA/>
</wsdl:BINICIARREPORT>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I don't know whether this is important, but the url I was given has no "?wsdl" at then end:
http://prueba/prueba/Pws_Lanza_Rep1.svc
Any clues?
I haven't figured it out yet, but following the steps here everything worked fine!
I have used the same xml and the same parameters, so it still remains a mistery to me why the previous code didn't work.
I've made a WS server from a WSDL definition (Contract first approach).
I've generated the Java artifacts with wsimport and tested the service.
Now I've got a problem. Some (not all) arguments of an operation requests are unmarshalled as null!
The web service is SOAP based. The wsdl follow the document-literal convention.
So, this is the schema imported by AbstractFDSInfo.wsdl:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.example.com/FDSControl"
xmlns:com="http://www.example.com/FDSCommon"
targetNamespace="http://www.example.com/FDSControl"
elementFormDefault="qualified">
<import namespace="http://www.example.com/FDSCommon" schemaLocation="FDSCommon.xsd"/>
<complexType name="PassengerList">
<sequence>
<element ref="com:Passenger" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="FlightInstanceStatusList">
<sequence>
<element type="com:flightInstanceStatus" name="Status" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<!-- other operation types here -->
<element name="setPassengerBoarded">
<complexType>
<sequence>
<element ref="com:FlightInstanceId"/>
<element type="string" name="Passenger"/>
</sequence>
</complexType>
</element>
<element name="setPassengerBoardedResponse">
<complexType/>
</element>
<element name="passengerBoardingException">
<complexType>
<sequence>
<element type="token" name="Reason"/>
<element type="string" name="Detail"/>
</sequence>
</complexType>
</element>
<!-- Other operation types here --->
And here is the FDSControlAbstract.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="FDSControlAbstract"
xmlns:tns="http://www.example.com/FDSControl.wsdl"
xmlns:con="http://www.example.com/FDSControl"
xmlns:com="http://www.example.com/FDSCommon"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.example.com/FDSControl.wsdl">
<types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.example.com/FDSCommon" schemaLocation="FDSCommon.xsd"/>
<xsd:import namespace="http://www.example.com/FDSControl" schemaLocation="FDSControl.xsd"/>
</xsd:schema>
</types>
<message name="setPassengerBoardedRequest">
<part element="con:setPassengerBoarded" name="Params"/>
</message>
<message name="setPassengerBoardedResponse">
<part element="con:setPassengerBoardedResponse" name="Params"/>
</message>
<message name="passengerBoardingException">
<part element="con:passengerBoardingException" name="Params"/>
</message>
<!-- other messages here -->
<portType name="FDSBoardingPortType">
<!-- other operations here -->
<operation name="setPassengerBoarded">
<documentation>
Sets a passenger as boarded. If the passenger is already boarded,
or the flight instance is not in the boarding status, an exception
is returned.
</documentation>
<input message="tns:setPassengerBoardedRequest"/>
<output message="tns:setPassengerBoardedResponse"/>
<fault message="tns:flightInstanceNotFoundException"
name="flightInstanceNotFoundException"/>
<fault message="tns:passengerBoardingException"
name="passengerBoardingException"/>
<fault message="tns:flightStatusException"
name="flightStatusException"/>
</operation>
</portType>
<!-- other port types here -->
</definitions>
Here is the FDSControl.wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="FDSControl"
xmlns:tns="http://www.example.com/FDSControl.wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.example.com/FDSControl.wsdl"
elementFormDefault="qualified">
<import namespace="http://www.example.com/FDSControl.wsdl" location="FDSControlAbstract.wsdl"/>
<!-- other bindings here-->
<binding name="FDSBoardingSOAP" type="tns:FDSBoardingPortType">
<!-- other operations here -->
<operation name="setPassengerBoarded">
<soap:operation soapAction="http://www.example.com/FDSControl/setPassengerBoarded"/>
<input> <soap:body use="literal"/> </input>
<output> <soap:body use="literal"/> </output>
<fault name="flightInstanceNotFoundException">
<soap:fault name="flightInstanceNotFoundException" use="literal"/>
</fault>
<fault name="passengerBoardingException">
<soap:fault name="passengerBoardingException" use="literal"/>
</fault>
<fault name="flightStatusException">
<soap:fault name="flightStatusException" use="literal"/>
</fault>
</operation>
</binding>
<service name="FDSBoardingSOAPService">
<port name="FDSBoardingPortType" binding="tns:FDSBoardingSOAP">
<soap:address location="http://localhost:7070/fdscontrol"/>
</port>
</service>
</definitions>
Now here is the definition of the java class implementing the web service:
#WebService(name="FDSBoarding",
endpointInterface="it.polito.dp2.FDS.lab4.server.gen.FDSBoardingPortType",
wsdlLocation="META-INF/FDSControl.wsdl",
portName="FDSBoardingPortType",
serviceName="FDSBoardingSOAPService",
targetNamespace="http://www.example.com/FDSControl.wsdl")
})
public class FDSControlImpl implements FDSBoardingPortType {
private FlightManager manager;
public FDSControlImpl(FlightManager manager) {
this.manager = manager;
}
//other methods here
#Override
public SetPassengerBoardedResponse setPassengerBoarded(SetPassengerBoarded params)
throws FlightInstanceNotFoundException_Exception, FlightStatusException_Exception, PassengerBoardingException_Exception {
return manager.setPassengerBoarded(params);
}
}
You can see I kept the parameters wrapped in a single class.
Now the problem is that, whenever I send a request for setPassengerBoarded(), the server returns null as params.getPassenger()
Is there something wrong with my structure/definitions?
I do not have commenting privileges. I would suggest that first test the web service through SOAP UI.
You would then be sure whether the service is working as you expect or some parameters need to change.
If your test is successful then try to set the same parameters in the proxy.
I was compiling two different WSDLs to the same package. I split the generated code in two packages and the problem disappeared, even though now I have duplicate classes and thus I need to convert back and forth between the these...
I am new to camel
I am trying to call webservice using camel java dsl
from("cxf://http://darshan:8080/sampleWebService/SampleTestServicePort?wsdlURL=http://darshan:8080/sampleWebService/SampleTestServicePort?wsdl&serviceName={http://ws.test.com/}SampleTestServiceService&portName={http://ws.test.com/}SampleTestServicePort&dataFormat=MESSAGE")
following is my wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.test.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.test.com/" name="SampleTestServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.test.com/" schemaLocation="http://darshan:808O/sampleWebService/SampleTestServicePort?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"></part>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"></part>
</message>
<portType name="SampleTestServiceDelegate">
<operation name="sayHello">
<input message="tns:sayHello"></input>
<output message="tns:sayHelloResponse"></output>
</operation>
</portType>
<binding name="SampleTestServicePortBinding" type="tns:SampleTestServiceDelegate">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="sayHello">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="SampleTestServiceService">
<port name="SampleTestServicePort" binding="tns:SampleTestServicePortBinding">
<soap:address location="http://darshan:808O/sampleWebService/SampleTestServicePort"></soap:address>
</port>
</service>
</definitions>
That gives no error but also output is nothing.
Please suggest me what is wrong in my code.
Thanks in advance
When you use the Apache CXF Component as a from() what you are doing is you are hosting the webservice instead of accessing a third-party one.
To access a third-party service you need to use the to() form of the component. You need to do something like this:
<route>
<from uri="file:./myFileRequest?delay=1000&include=myRequest.xml">
<to uri="cxf://http://darshan:8080/sampleWebService/SampleTestServicePort?wsdlURL=http://darshan:8080/sampleWebService/SampleTestServicePort?wsdl&serviceName={http://ws.test.com/}SampleTestServiceService&portName={http://ws.test.com/}SampleTestServicePort&dataFormat=MESSAGE" />
...
</route>
Is this what you are looking for?
Define the cxf bean as below in the camel context
<cxf:cxfEndpoint
address="Service ENDPOINT"
endpointName="give wsdl:port#name here from wsdl"
id="any id" loggingFeatureEnabled="true"
serviceClass="your service class - it will be inside the stubs generated from WSDL"
serviceName="Service Name"
wsdlURL="WSDL path" xmlns:ws="namespace">
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD"/>
</cxf:properties>
</cxf:cxfEndpoint>
then write the following in your route:
<to id="_to1" uri="cxf:bean:id Of the cxfEndpoint bean"/>
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