Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Create request object from WSDL

  1. #1
    Join Date
    Apr 2009
    Posts
    6

    Default Create request object from WSDL

    Could you please give some directions on this..

    What tool should I use to get java objects corresponding xml elements in WSDL (no XSD in WSDL). Once I get those objects, I can pass in my service layer to fill out.

    Thanks,

  2. #2
    Join Date
    Sep 2006
    Posts
    100

    Default

    wsimport for jax-ws; wsdl2java for axis are couple examples. These commands generate necessary java classes from WSDL.

  3. #3
    Join Date
    Apr 2009
    Posts
    6

    Default

    thank you for quick reply.

    Yes I used wsdl2java tool and it is creating java files.. but java objects contains the methods specific to axis.. example, it has the following methods: parse(), getParser(), registerPrefix(), writeQNames(), writeAttribute(), getOMElement() etc., I do not see attributes corresponding to xml elements.

    here the command which I used.
    wsdl2java -ss -g -uri http://localhost:8080/echo/myecho?WSDL

    What I want is, java object should have getters and setters; similary to xjc which convers xsd to java files. Since I dont have XSD, I want to extract type/schema from WSDL and generate java files.

    Here is the reason I am asking, currently I have one wsdl and it has imported XSD, I used xjc tool to convert xml to java objects and used in Spring to get data. And there is another wsdl which my business partner is building has no imported XSD, schema is embedded in the WSDL and I could not use xjc to get java files.

    I hope, I explained the problem I am facing here..

    Thanks,
    Gouri

  4. #4
    Join Date
    Dec 2007
    Posts
    11

    Default

    Just do a cut and paste job and lift out the inline schema - jobs a good un.

  5. #5
    Join Date
    Apr 2009
    Posts
    6

    Default

    Thank you,

    I took out schema and generated java files. I am able to generate Request and while calling WebServiceTemplate.marshalSendAndReceive(), I am getting the following error:

    org.springframework.ws.client.WebServiceTransportE xception: Forbidden [403]
    at org.springframework.ws.client.core.WebServiceTempl ate.handleError(WebServiceTemplate.java:561)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:489)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:440)
    at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 289)
    at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 283)
    at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 275)
    at sample.CallWS.callEmpInfo(Unknown Source)

    If I call the same WS by sending same request in SoapUI, I am getting response.

    so I am doing something wrong, but I could not see where it is. Can you please help me.

    -Gouri

  6. #6
    Join Date
    Apr 2009
    Posts
    6

    Default

    I could figured it out the mistake, i made spelling mistake in my URI value in my bean. I corrected it and is working fine.

    Thank you.

  7. #7
    Join Date
    Aug 2010
    Posts
    4

    Lightbulb New to create web service client

    Hi,

    I am creating WebService client for the first time. I have read WebServiceTemplate tutorial to understand some of the points.

    I have to call some of the methods of a webservice and I have WSDL.

    I need to know how to call specific methods of WebService using WebServiceTemplate and how to pass the parameters required to call the webservice method.

    I have read that I can use SoapAction to specify which method to call but not sure how to send the parameters.

    Please help.

  8. #8

    Default

    I think that is what the Uri setting is for. Which can be set either in the bean config for the WebServiceTemplate or passed into the send~ method you wish to use.

    I could be wrong, pretty new to Spring-ws myself.

  9. #9
    Join Date
    Aug 2010
    Posts
    4

    Post

    DefaultUri is the URL to access the WebService I guess.
    What I need here is to call one of the methods of the webservice and before calling the method need to assign params.

    What I think I need to do is to create WebServiceMessage and set the params in it but not sure how to do it.

    Thanks for your reply though.

  10. #10

    Default

    Ah, ok, not so sure.
    My understanding was that assuming you have you Template setup correctly, you should be able to create one of the request objects generated from the wsdl, populate this with values, make this the parameter of one of the send methods, and that was all there is too it.

    At least that my understanding.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •