Why java2wsdl from axis2 produce not valid wsdl - web-services

Why java2wsdl from axis2 produce wsdl not validated by Altova XmlSpy?
I got error
attribute 'part' in extensibility element '<mime:content>' refers to part 'myMethod' which could not be found in message 'myMethodRequest'
Error location: wsdl:definitions / wsdl:binding / wsdl:operation / wsdl:input / mime:content / #part
Where is the bug?
axis2 version 1.5.4
Altova XmlSpy version 2011 rel2
Sample Class:
package my.pkg;
public class SampleWs {
public String myMethod(String objectId) {
return objectId;
}
}
Sample generated wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://pkg.my" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://pkg.my">
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pkg.my">
<xs:element name="myMethod">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="objectId" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="myMethodResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="myMethodRequest">
<wsdl:part name="parameters" element="ns:myMethod"/>
</wsdl:message>
<wsdl:message name="myMethodResponse">
<wsdl:part name="parameters" element="ns:myMethodResponse"/>
</wsdl:message>
<wsdl:portType name="SampleWsPortType">
<wsdl:operation name="myMethod">
<wsdl:input message="ns:myMethodRequest" wsaw:Action="urn:myMethod"/>
<wsdl:output message="ns:myMethodResponse" wsaw:Action="urn:myMethodResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SampleWsSoap11Binding" type="ns:SampleWsPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="myMethod">
<soap:operation soapAction="urn:myMethod" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SampleWsSoap12Binding" type="ns:SampleWsPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="myMethod">
<soap12:operation soapAction="urn:myMethod" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SampleWsHttpBinding" type="ns:SampleWsPortType">
<http:binding verb="POST"/>
<wsdl:operation name="myMethod">
<http:operation location="SampleWs/myMethod"/>
<wsdl:input>
<mime:content type="text/xml" part="myMethod"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="myMethod"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SampleWs">
<wsdl:port name="SampleWsHttpSoap11Endpoint" binding="ns:SampleWsSoap11Binding">
<soap:address location="http://localhost:8080/axis2/services/SampleWs"/>
</wsdl:port>
<wsdl:port name="SampleWsHttpSoap12Endpoint" binding="ns:SampleWsSoap12Binding">
<soap12:address location="http://localhost:8080/axis2/services/SampleWs"/>
</wsdl:port>
<wsdl:port name="SampleWsHttpEndpoint" binding="ns:SampleWsHttpBinding">
<http:address location="http://localhost:8080/axis2/services/SampleWs"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

It seems bug in axis2 java2wsdl version 1.5.4
Switched to 1.6.2 version - now all OK

Related

I get the following Error: No global element for root was found: {urn:com.companyname.dto}CalloutRequest

I try to implement a SOAP-webservice with spring boot. Everything seems normal until I want to call it. I get the following Message:
No global element for root was found: {urn:com.companyname.dto}CalloutRequest
The wsdl looks the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:com.companyname"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:com.companyname"
xmlns:dto="urn:com.companyname.dto">
<wsdl:types>
<xs:schema targetNamespace="urn:com.companyname">
<xs:import schemaLocation="CalloutServiceDto.xsd" namespace="urn:com.companyname.dto"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="CalloutRequestMessage">
<wsdl:part name="request" element="dto:CalloutRequest"></wsdl:part>
</wsdl:message>
<wsdl:message name="CalloutResponseMessage">
<wsdl:part name="response" element="dto:CalloutResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="CalloutPortType">
<wsdl:operation name="callMeldungAusgang">
<wsdl:documentation>Wird eine KVUVMeldung zurueck ins SHIP erzeugt, erfolgt dies ueber diesen Service.
</wsdl:documentation>
<wsdl:input message="tns:CalloutRequestMessage"></wsdl:input>
<wsdl:output message="tns:CalloutResponseMessage"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalloutBinding" type="tns:CalloutPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="callMeldungAusgang">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CalloutService">
<wsdl:port name="CalloutPort" binding="tns:CalloutBinding">
<soap:address location="http://localhost:8080/Callout" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="urn:com.companyname.dto"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:com.companyname.dto"
elementFormDefault="qualified">
<xs:element name="CalloutRequest"
type="tns:CalloutRequestType" />
<xs:element name="CalloutResponse"
type="tns:CalloutResponseType" />
<xs:complexType name="CalloutRequestType">
<xs:annotation>
<xs:documentation>
Request fuer einen MeldungsAusgang, welcher ins gesendet wird.
e Beinhaltet nur das Response-XML, gehalten als String.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="xml" type="xs:string" minOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CalloutResponseType">
<xs:annotation>
<xs:documentation>
Die Antwort der MeldungsAusgangs-Service
</xs:documentation>
</xs:annotation>
</xs:complexType>
</xs:schema>
If I call the webservice he gives me the error that there is no root element. I generate my code with wsdl2java and it works just fine. Just when I call the service via http://localhost:8080/Callout it gives me the error.
Thanks in advance

How To Get Response XML From Generated Stub

I'm using Axis2's wsdl2java to generate a stub for the following WSDL (please note that if names don't match up, it's probably from my obfuscation of the code):
<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://test.com/saucy/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test.com/saucy/definitions" targetNamespace="http://test.com/saucy/definitions">
<wsdl:types>
<xs:schema xmlns:wtfd="http://test.com/saucy/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://test.com/saucy/schemas">
<xs:element name="fubarmanagerRequest">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="1" name="addUsers" type="wtfd:addUsersType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="addUsersType">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="user" type="wtfd:userType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="userType">
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="1" name="emailAddress" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="1" name="password" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="fubarmanagerRequest">
<wsdl:part element="sch:fubarmanagerRequest" name="fubarmanagerRequest">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="wtfsaucy">
<wsdl:operation name="fubarmanager">
<wsdl:input message="tns:fubarmanagerRequest" name="fubarmanagerRequest">
</wsdl:input>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="wtfsaucySoap11" type="tns:wtfsaucy">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="fubarmanager">
<soap:operation soapAction=""/>
<wsdl:input name="fubarmanagerRequest">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="wtfsaucyService">
<wsdl:port binding="tns:wtfsaucySoap11" name="wtfsaucySoap11">
<soap:address location="http://localhost:8080/mailerManagerService/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
However, it seems like the generated stub isn't providing a means for me to retrieve the response XML:
/**
* Auto generated method signature
*
*/
public void fubarManager(com.obfuscated.fubarRequest fubarRequest0
) throws java.rmi.RemoteException
I'm able to get the response XML in SoapUI, but How can I retrieve it through the web generated service client code? Is something missing from my WSDL? Are there additional options I should be passing to wsdl2java?
I had to make sure my WSDL included a section for the response message:
<wsdl:portType name="wtfDirect">
<wsdl:operation name="MailManager">
<wsdl:input message="tns:MailManagerRequest" name="MailManagerRequest">
</wsdl:input>
<wsdl:output message="tns:MailManagerResponse" name="MailManagerResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>

Please advise on the WSDL

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.

axis2 - Error parsing WSDL

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.

Axis2 : wsdl2java tool Command line

I have this WSDL File already given .
When i used the Axis2 tool wsdl2java -uri StockQuoteService.wsdl
<wsdl:definitions xmlns:axis2="http://quickstart.samples/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns="http://quickstart.samples/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://quickstart.samples/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://quickstart.samples/xsd">
<xs:element name="getPrice">
<xs:complexType>
<xs:sequence>
<xs:element name="symbol" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getPriceResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="getPriceMessage">
<wsdl:part name="part1" element="ns:getPrice" />
</wsdl:message>
<wsdl:message name="getPriceResponseMessage">
<wsdl:part name="part1" element="ns:getPriceResponse" />
</wsdl:message>
<wsdl:portType name="StockQuoteServicePortType">
<wsdl:operation name="getPrice">
<wsdl:input message="axis2:getPriceMessage" />
<wsdl:output message="axis2:getPriceResponseMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StockQuoteServiceSOAP11Binding" type="axis2:StockQuoteServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="getPrice">
<soap:operation soapAction="urn:getPrice" style="document" />
<wsdl:input>
<soap:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="http://quickstart.samples/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="StockQuoteService">
<wsdl:port name="StockQuoteServiceSOAP11port" binding="axis2:StockQuoteServiceSOAP11Binding">
<soap:address
location="http://localhost:8080/axis2/services/StockQuoteService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
What i was expecting is the java code that should be
package samples.quickstart;
import java.util.HashMap;
public class StockQuoteService {
private HashMap map = new HashMap();
public double getPrice(String symbol) {
Double price = (Double) map.get(symbol);
if(price != null){
return price.doubleValue();
}
return 42.00;
}
}
But when i ran wsdl2java -uri StockQuoteService.wsdl
i got this code of java files , where i was expecting the above java file
1.StockQuoteServiceCallbackHandler
2.StockQuoteServiceStub
but not StockQuoteService.java
package samples.quickstart;
import java.util.HashMap;
public class StockQuoteService {
private HashMap map = new HashMap();
public double getPrice(String symbol) {
Double price = (Double) map.get(symbol);
if(price != null){
return price.doubleValue();
}
return 42.00;
}
}
please tell me why so ??
wsdl2java command generates client code to invoke your axis2 service (i.e. Stub and callback handler classes). The business logic inside getPrice() method has nothing to do with your wsdl.