facebook

While genrating from WSDL to java files is coming problem

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #267538 Reply

    nvenkatarao
    Member

    Hi,

    please let me know the steps ..how to generate the normal java code from WSDL file …..

    if i generated using builtin XFire in the my eclipse …..that ordinary java class is generating elements with JAXBElement<stirng> ……….but i dont want like this i want only String variable……

    please reply immediatley …..

    Thanks in Advance

    #267606 Reply

    Riyad Kalla
    Member

    This is how the wizard behaves. If you want to adjust this I suppose you can manually edit the files, but I don’t know how you would edit it.

    #267617 Reply

    tomeksz
    Member

    Thats way jaxb works. Check jaxb documentation about customizing types.

    #267622 Reply

    nvenkatarao
    Member

    where i need to check jaxb documentation.

    #267636 Reply

    tomeksz
    Member

    Can you post your wsdl ?

    #267647 Reply

    nvenkatarao
    Member

    Thanks for your response please look into below wsdl file …this was generated by myeclipse auto matically…..

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <wsdl:definitions xmlns:soap11=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope&#8221; xmlns:soapenc11=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xmlns:soapenc12=”http://www.w3.org/2003/05/soap-encoding&#8221; xmlns:tns=”http://service.ws.rs.com&#8221; xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/&#8221; xmlns:wsdlsoap=”http://schemas.xmlsoap.org/wsdl/soap/&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; targetNamespace=”http://service.ws.rs.com”&gt;
    <wsdl:types>
    <xsd:schema attributeFormDefault=”qualified” elementFormDefault=”qualified” targetNamespace=”http://service.ws.rs.com”&gt;
    <xsd:complexType name=”GetCompanyRequest”>
    <xsd:sequence>
    <xsd:element minOccurs=”0″ name=”companyId” type=”xsd:int”/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name=”GetCompanyResponse”>
    <xsd:sequence>
    <xsd:element minOccurs=”0″ name=”addr” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”companyId” type=”xsd:int”/>
    <xsd:element minOccurs=”0″ name=”companyName” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”error” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”state” nillable=”true” type=”xsd:string”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name=”getComapanyInfoRequest”>
    <wsdl:part name=”in0″ type=”tns:GetCompanyRequest”/>
    </wsdl:message>
    <wsdl:message name=”getComapanyInfoResponse”>
    <wsdl:part name=”out” type=”tns:GetCompanyResponse”/>
    </wsdl:message>
    <wsdl:portType name=”GetCompanyInfoPortType”>
    <wsdl:operation name=”getComapanyInfo”>
    <wsdl:input message=”tns:getComapanyInfoRequest” name=”getComapanyInfoRequest”/>
    <wsdl:output message=”tns:getComapanyInfoResponse” name=”getComapanyInfoResponse”/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name=”GetCompanyInfoHttpBinding” type=”tns:GetCompanyInfoPortType”>
    <wsdlsoap:binding style=”rpc” transport=”http://schemas.xmlsoap.org/soap/http”/&gt;
    <wsdl:operation name=”getComapanyInfo”>
    <wsdlsoap:operation soapAction=””/>
    <wsdl:input name=”getComapanyInfoRequest”>
    <wsdlsoap:body namespace=”http://service.ws.rs.com&#8221; use=”literal”/>
    </wsdl:input>
    <wsdl:output name=”getComapanyInfoResponse”>
    <wsdlsoap:body namespace=”http://service.ws.rs.com&#8221; use=”literal”/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name=”GetCompanyInfo”>
    <wsdl:port binding=”tns:GetCompanyInfoHttpBinding” name=”GetCompanyInfoHttpPort”>
    <wsdlsoap:address location=”http://localhost:8080/mambo-webservice-test/services/GetCompanyInfo”/&gt;
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    #267664 Reply

    tomeksz
    Member

    This jaxb behavior is caused by combination of minOccurs=”0″ nillable=”true” attributes , if you change one of them to e.g minOccurs=”1″, then jaxb should generate valid type instead of jaxbelement.
    So if you have access to server side service then you can try to customize service to generate minOccure=”1″
    or save wsdl to file and replace all minOccurs=”0″ with minOccours=”1″ and then generate client code.

    #267736 Reply

    nvenkatarao
    Member

    Thanks. I got it.

    Is there any way to generate automatically minOccures=”1″ instead of customizing the service.

    #267743 Reply

    tomeksz
    Member

    This wsdl is generated by XFire ? Then you can set these values per method using aegis mapping file or you can set this globally ( but i dont remember how, must check the source 🙂

    #267746 Reply

    nvenkatarao
    Member

    Yes you are correct, I mean that wsdl generated by XFire only.
    I don’t find any mapping files over there….like you said aegis mapping files…..
    I don’t know why your choosing XFire instead of Axis……is there any good advantages is there over Axis….
    If you have any documentation can you please send out that link for me…

    #267747 Reply

    tomeksz
    Member

    Sure there are advantages 🙂 But i don’t want to start any flame war here 🙂
    Here is a link with the description how to customize wsdl with mapping files:
    http://xfire.codehaus.org/Aegis+Binding

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: While genrating from WSDL to java files is coming problem

You must be logged in to post in the forum log in