I have created a WSDL to create a greeting service. Given below is the WSDL.
I am using thsi wsdl to create a generate and expose a web-service using the cxf:proxy-service in mule.
This is giving me errors.
Please review and help me undertand what is the problem with this WSDL.
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions name="HelloService"
targetNamespace="http://example.org/HelloService"
xmlns:tns="http://example.org/HelloService"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema targetNamespace="http://example.org/HelloService" >
<xsd:element name="LastName">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="lName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="FirstName">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="fName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Greeting">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="greet" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="shortRequest">
<wsdl:part type="tns:LastName" name="lastName"/>
</wsdl:message>
<wsdl:message name="fullRequest">
<wsdl:part type="tns:FirstName" name="firstName"/>
<wsdl:part type="tns:LastName" name="lastName"/>
</wsdl:message>
<wsdl:message name="greetingResponse">
<wsdl:part type="tns:greeting" name="greetings"/>
</wsdl:message>
<wsdl:portType name="HelloServicePortType">
<wsdl:operation name="simpleGreeting">
<wsdl:input message="tns:shortRequest" name="shortRequest" />
<wsdl:output message="tns:greetingResponse" name="greetingResponse" />
</wsdl:operation>
<wsdl:operation name="fullGreeting">
<wsdl:input message="tns:fullRequest" name="fullRequest" />
<wsdl:output message="tns:greetingResponse" name="greetingResponseFull" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloServiceSOAP" type="tns:HelloServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="simpleGreeting">
<soap:operation soapAction="" style="document" />
<wsdl:input name="shortRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="greetingResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="fullGreeting">
<soap:operation soapAction="" style="document" />
<wsdl:input name="fullRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="greetingResponseFull">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProxyService">
<wsdl:port binding="tns:HelloServiceSOAP" name="HelloServiceSOAPB">
<soap:address location="http://localhost:8080/HelloService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Please help me if there is something wrong in my WSDL.
It is not working when I use it in mule cxf:proxy-service.
FGiven below si the Mule Flow which is using this WSDL to expose service.
<flow name="WS_In">
<http:inbound-endpoint address="http://localhost:8080/HelloService" exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:globalid3.wsdl" namespace="http://example.org/HelloService" service="ProxyService" />
</http:inbound-endpoint>
<component>
<prototype-object class="com.example.ServiceProxy">
</prototype-object>
</component>
<echo-component></echo-component>
<logger level="INFO" />
</flow>
and the Error is :
org.mule.api.lifecycle.LifecycleException: Lifecycle Manager 'WS_In.stage1' phase 'start' does not support phase 'dispose'
at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:156)
There is a casing issue in your WSDL. Instead of:
<wsdl:message name="greetingResponse">
<wsdl:part type="tns:greeting" name="greetings"/>
</wsdl:message>
you should have:
<wsdl:message name="greetingResponse">
<wsdl:part type="tns:Greeting" name="greetings"/>
</wsdl:message>
With this fixed, the following produces a web service that works fine when called from SOAPui:
<flow name="WS_In">
<http:inbound-endpoint address="http://localhost:8080/HelloService"
exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:globalid3.wsdl"
namespace="http://example.org/HelloService" service="ProxyService" />
</http:inbound-endpoint>
<custom-processor class="com.example.ServiceProxy" />
</flow>
Message processor:
package com.example;
import javax.xml.namespace.QName;
import org.apache.commons.lang.StringEscapeUtils;
import org.mule.api.MuleEvent;
import org.mule.api.MuleException;
import org.mule.api.processor.MessageProcessor;
public class ServiceProxy implements MessageProcessor
{
private final static QName SIMPLE_GREETING = new QName("http://example.org/HelloService",
"simpleGreeting");
public MuleEvent process(final MuleEvent event) throws MuleException
{
final QName operation = event.getFlowVariable("cxf_operation");
if (operation.equals(SIMPLE_GREETING))
{
final String lastName = event.getMuleContext()
.getExpressionLanguage()
.evaluate("xpath('/lastName').text", event);
final String responseXml = "<greetings><greet>Hi " + StringEscapeUtils.escapeXml(lastName)
+ "</greet></greetings>";
event.getMessage().setPayload(responseXml);
return event;
}
throw new UnsupportedOperationException(operation.getLocalPart() + " " + operation.getNamespaceURI()
+ " " + operation.getPrefix());
}
}
There is one way to do this using cxf:jaxws-service, but you'll need to generate the service class. Take a look here on how to do this.
After that you can configure the service in a very simple way.
<cxf:jaxws-service
serviceClass="mypackage.webservices.MyServicePortType"
validationEnabled="false">
</cxf:jaxws-service>
The flow that is working is as below.
<flow name="WS_In">
<http:inbound-endpoint address="http://localhost:8080/HelloService" exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:helloservice.wsdl" namespace="http://example.org/HelloService" service="ProxyService" />
</http:inbound-endpoint>
<component>
<prototype-object class="com.example.ServiceProxy">
</prototype-object>
</component>
<echo-component></echo-component>
<logger level="INFO" />
</flow>
And the WSDL is
<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions name="HelloService"
targetNamespace="http://example.org/HelloService"
xmlns:tns="http://example.org/HelloService"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="shortRequest">
<wsdl:part type="xsd:string" name="lastName"/>
</wsdl:message>
<wsdl:message name="fullRequest">
<wsdl:part type="xsd:string" name="firstName"/>
<wsdl:part type="xsd:string" name="lastName"/>
</wsdl:message>
<wsdl:message name="greetingResponse">
<wsdl:part type="xsd:string" name="greetings"/>
</wsdl:message>
<wsdl:portType name="HelloServicePortType">
<wsdl:operation name="simpleGreeting">
<wsdl:input message="tns:shortRequest" name="shortRequest" />
<wsdl:output message="tns:greetingResponse" name="greetingResponse" />
</wsdl:operation>
<wsdl:operation name="fullGreeting">
<wsdl:input message="tns:fullRequest" name="fullRequest" />
<wsdl:output message="tns:greetingResponse" name="greetingResponseFull" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloServiceSOAP" type="tns:HelloServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="simpleGreeting">
<soap:operation soapAction="" style="document" />
<wsdl:input name="shortRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="greetingResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="fullGreeting">
<soap:operation soapAction="" style="document" />
<wsdl:input name="fullRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="greetingResponseFull">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProxyService">
<wsdl:port binding="tns:HelloServiceSOAP" name="HelloServiceSOAPB">
<soap:address location="http://localhost:8080/HelloService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Thanks everyone for your help and support.
Related
Setting up a webservice on my Symfony server, I follow this guide:
https://symfony.com/doc/current/controller/soap_web_service.html
Example given is working well, with this hello fonction:
public function hello($name)
{
return 'Hello, '.$name;
}
So I've tried to complete this webservice with this bye function:
public function bye($name)
{
return 'Goodbye, '.$name;
}
And here is my wsdl:
<?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:arnleadservicewsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:helloservicewsdl">
<types>
<xsd:schema targetNamespace="urn:hellowsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="helloRequest">
<part name="name" type="xsd:string" />
</message>
<message name="helloResponse">
<part name="return" type="xsd:string" />
</message>
<message name="byeRequest">
<part name="name" type="xsd:string" />
</message>
<message name="byeResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="hellowsdlPortType">
<operation name="hello">
<documentation>Hello World</documentation>
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
<operation name="bye">
<documentation>Goodbye World</documentation>
<input message="tns:byeRequest"/>
<output message="tns:byeResponse"/>
</operation>
</portType>
<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:arnleadservicewsdl#hello" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="bye">
<soap:operation soapAction="urn:arnleadservicewsdl#bye" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="hellowsdl">
<port name="hellowsdlPort" binding="tns:hellowsdlBinding">
<soap:address location="http://10.0.0.42/esi/soap" />
</port>
</service>
</definitions>
Hello function is still working, but each time i call bye function, I get an error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML
Where am I wrong?
Ok, first I have rewritten my WSDL with help of https://www.wsdl-analyzer.com/. Here is my new WSDL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions name="helloServiceController"
targetNamespace="urn:helloServiceControllerwsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:helloServiceControllerwsdl">
<wsdl:types>
<xsd:schema targetNamespace="urn:helloServiceControllerwsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="helloRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="helloResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="helloServicePortType">
<wsdl:operation name="hello">
<wsdl:documentation>Hello World</wsdl:documentation>
<wsdl:input message="tns:helloRequest"/>
<wsdl:output message="tns:helloResponse"/>
</wsdl:operation>
<wsdl:operation name="bye">
<wsdl:documentation>Bye World</wsdl:documentation>
<wsdl:input message="tns:byeRequest"/>
<wsdl:output message="tns:byeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="helloServiceBinding" type="tns:helloServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:helloServiceControllerwsdl#hello" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="bye">
<soap:operation soapAction="urn:helloServiceControllerwsdl#bye" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="helloService">
<wsdl:port name="helloServicePort" binding="tns:helloServiceBinding">
<soap:address location="http://10.0.0.42/esi/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
After that, it was still not working and even hello function was not working. After pulling my hair for a while, I simply restarted my server and it was good. Probably a cache problem!
I have created a web service using Axis2 and I want to change the Content-type of my response from text/xml; charset=UTF-8 to text/xml; charset=utf-8.
Only when I send the Content-type as text/xml; charset=utf-8 in request header, it returns corretly. But in my case, I don't have that flexibility. So, I need to find a way to change th default Content-Type to text/xml; charset=utf-8.
Can some one give an idea on how to change this?
I have tried below like options but no any luck.
WSDL :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="GradeTenMathService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xs:schema>
<xs:import namespace="http://tempuri.org/" schemaLocation="Math.xsd"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="AdditionResponse">
<wsdl:part name="AdditionRS" element="tns:AdditionResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="AdditionRequest">
<wsdl:part name="AdditionRQ" element="tns:AdditionRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="DevisionResponse">
<wsdl:part name="DevisionRS" element="tns:DevisionResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="DevisionRequest">
<wsdl:part name="DevisionRQ" element="tns:DevisionRequest">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="GradeTenMathPortType">
<wsdl:operation name="Addition">
<wsdl:input message="tns:AdditionRequest">
</wsdl:input>
<wsdl:output message="tns:AdditionResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Devision">
<wsdl:input message="tns:DevisionRequest">
</wsdl:input>
<wsdl:output message="tns:DevisionResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GradeTenMathBinding" type="tns:GradeTenMathPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Addition">
<soap:operation soapAction="Addition" style="document"/>
<wsdl:input>
<mime:content part="Addition" type="text/xml; charset=utf-8"/>
</wsdl:input>
<wsdl:output>
<mime:content part="Addition" type="text/xml; charset=utf-8"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Devision">
<soap:operation soapAction="Devision" style="document"/>
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GradeTenMath">
<wsdl:port name="GradeTenMathPort" binding="tns:GradeTenMathBinding">
<soap:address location="http://localhost:8081/axis2/services/GradeTenMath"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I started learning Web Services. I wrote my first piece of code from the example that was given in the book. But when i run it, it does not behanve the way its supposed to! I see the wsdl file generated and see the error:
My WSDL file is:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ts.ch01" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ts.ch01" xmlns:intf="http://ts.ch01" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://ts.ch01" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="getTimeAsString">
<complexType/>
</element>
<element name="getTimeAsStringResponse">
<complexType>
<sequence>
<element name="getTimeAsStringReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getTimeAsElapsed">
<complexType/>
</element>
<element name="getTimeAsElapsedResponse">
<complexType>
<sequence>
<element name="getTimeAsElapsedReturn" type="xsd:long"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getTimeAsStringResponse">
<wsdl:part element="impl:getTimeAsStringResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsElapsedResponse">
<wsdl:part element="impl:getTimeAsElapsedResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsElapsedRequest">
<wsdl:part element="impl:getTimeAsElapsed" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getTimeAsStringRequest">
<wsdl:part element="impl:getTimeAsString" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="WSNewTestImpl">
<wsdl:operation name="getTimeAsString">
<wsdl:input message="impl:getTimeAsStringRequest" name="getTimeAsStringRequest">
</wsdl:input>
<wsdl:output message="impl:getTimeAsStringResponse" name="getTimeAsStringResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTimeAsElapsed">
<wsdl:input message="impl:getTimeAsElapsedRequest" name="getTimeAsElapsedRequest">
</wsdl:input>
<wsdl:output message="impl:getTimeAsElapsedResponse" name="getTimeAsElapsedResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WSNewTestImplSoapBinding" type="impl:WSNewTestImpl">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getTimeAsString">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getTimeAsStringRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getTimeAsStringResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getTimeAsElapsed">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getTimeAsElapsedRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getTimeAsElapsedResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WSNewTestImplService">
<wsdl:port binding="impl:WSNewTestImplSoapBinding" name="WSNewTestImpl">
<wsdlsoap:address location="http://localhost:9090/WSTestOther/services/WSNewTestImpl"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I am not sure what other information to provide, if you need anything just ask. I am using Tomcat 7.0
Also I see the error in console:
[ERROR] The endpoint reference (EPR) for the Operation not found is /WSTestOther/services/WSNewTestImplService and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /WSTestOther/services/WSNewTestImplService and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.
at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)
at org.apache.axis2.engine.Phase.invoke(Phase.java:329)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:837)
at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:273)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
[WARN] Deprecated usage of OMElement#declareNamespace(String,String) with empty prefix
Can Anyone tell me way to version Wsdl contracts(wsdl first service) for major and minor versions.any running example will be very helpful.
The way I m following to version my wsdl is this.I am following Iona webservices versioning guidlines
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ProductServiceImplServicev2"
targetNamespace="http://service.dtechtalkcenter.com/servicev2"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://service.dtechtalkcenter.com/servicev2"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" `enter code here`
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:v2_0="http://service.dtechtalkcenter.com/servicev2.0"
xmlns:v2_1="http://service.dtechtalkcenter.com/servicev2.1">
<wsdl:types>
<xsd:schema elementFormDefault="unqualified" targetNamespace="http://service.dtechtalkcenter.com/servicev2.0">
<xsd:element name="addProduct" type="v2_0:addProduct"/>
<xsd:element name="addProductResponse" type="v2_0:addProductResponse"/>
<xsd:element name="getProducts" type="v2_0:getProducts"/>
<xsd:element name="getProductsResponse" type="v2_0:getProductsResponse"/>
<xsd:complexType name="getProducts">
<xsd:sequence/>
</xsd:complexType>
<xsd:complexType name="getProductsResponse">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="return" type="v2_0:product"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="product">
<xsd:sequence>
<xsd:element name="cast" type="xsd:double"/>
<xsd:element minOccurs="0" name="productCategory" type="xsd:string"/>
<xsd:element minOccurs="0" name="productDetails" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="addProduct">
<xsd:sequence>
<xsd:element minOccurs="0" name="product" type="v2_0:product"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="addProductResponse">
<xsd:sequence/>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="addProductResponse">
<wsdl:part name="parameters" element="v2_0:addProductResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getProducts">
<wsdl:part name="parameters" element="v2_0:getProducts">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addProduct">
<wsdl:part name="parameters" element="v2_0:addProduct">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getProductsResponse">
<wsdl:part name="parameters" element="v2_0:getProductsResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ProductService_v2_0">
<wsdl:operation name="getProducts">
<wsdl:input name="getProducts" message="tns:getProducts">
</wsdl:input>
<wsdl:output name="getProductsResponse" message="tns:getProductsResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addProduct">
<wsdl:input name="addProduct" message="tns:addProduct">
</wsdl:input>
<wsdl:output name="addProductResponse" message="tns:addProductResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ProductServiceImplService_v2_0_SoapBinding" type="tns:ProductService_v2_0">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getProducts">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="getProducts">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getProductsResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addProduct">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="addProduct">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addProductResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ProductServiceImplService_v2_0">
<wsdl:port name="ProductServiceImplPort" binding="tns:ProductServiceImplService_v2_0_SoapBinding">
<soap:address location="http://localhost:8088/VersionService/services/ProductServiceImplPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I'm new in using axis2 and I'trying to generate java classes from a wsdl.
Unfotunately I get the following exception :
org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
I cannot figure out how to find the problem.
I work with axis2-1.6.2 on jdk1.7 and win7.
Any hint would be appreciated.
Flavio
here is my wsdl :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="IFX170PortType"
targetNamespace="urn:ifxforum-org:WSDL:1:PortType"
xmlns:tns="urn:ifxforum-org:WSDL:1:PortType"
xmlns:types="urn:ifxforum-org:WSDL:1:PortType:types"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema
targetNamespace="urn:ifxforum-org:WSDL:1:PortType:types"
xmlns:ifx="urn:ifxforum-org:XSD:1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:import namespace="urn:ifxforum-org:XSD:1"
schemaLocation="IFX170.xsd"/>
<xsd:element name="DoIFXRq">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ifx:IFX" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="DoIFXRs">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="ifx:IFX" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="DoIFXRqMsg">
<wsdl:part name="parameters" element="types:DoIFXRq"/>
</wsdl:message>
<wsdl:message name="DoIFXRsMsg">
<wsdl:part name="result" element="types:DoIFXRs"/>
</wsdl:message>
<wsdl:portType name="IFX170PortType">
<wsdl:operation name="DoIFX">
<wsdl:input message="tns:DoIFXRqMsg"/>
<wsdl:output message="tns:DoIFXRsMsg"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="IFX170SOAPBinding" type="IFX170PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="DoIFX">
<soap:operation style="document" soapAction="getDoIFX" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="IFX170Service">
<wsdl:port name="IFX170SOAPPort" binding="IFX170SOAPBinding">
<soap:address location="http://localhost:8080/axis2/services /StockQuoteService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
If still having issues, try the following updates to the WSDL to ensure that the related entities within the WSDL are properly referenced:
<wsdl:binding name="IFX170SOAPBinding" type="tns:IFX170PortType">
<wsdl:service name="IFX170Service">
<wsdl:port name="IFX170SOAPPort" binding="tns:IFX170SOAPBinding">
Note the use of the 'tns:' prefix in the type and binding attributes respectively.