axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ephemeris Lappis" <ephemeris.lap...@gmail.com>
Subject RE: how to call a document style web service?
Date Wed, 08 Jun 2005 05:36:34 GMT
I'm not absolutly sure, but i think you can also use the call object to pass
a complex type parameter, ensuring the type mapping exist for its java
class, and a serializer/deserializer too. My example is using a standard
document style, with a single parameter that is a string. I suppose you
could use the same way to pass a user defined type. But i have never done
it...
I think using the envelope is a low level task that you may avoid... Why
can't you use generated stubs ?
  -----Original Message-----
  From: Kiran Kumar [mailto:kkumar@objectwave.com]
  Sent: Tuesday, June 07, 2005 11:34 PM
  To: axis-user@ws.apache.org
  Subject: RE: how to call a document style web service?


  Thank You Ephemeris Lappis for your response.

  I am not using 'wrapped' style web service. If it was the case I would
pass the input parameters in the way you described in your example.

  My service end point method signature is something like 

  public Geocode individual(Gcindividualinputs gcindividualinputs) throws
java.rmi.RemoteException ;

  Here the input is being received as an object (Gcindividualinputs is being
generated by WSDL2Java file) so I will have to send the input in 'xml'
format which maps to Gcindividualinputs value object at run time by Axis.

  The issue is, I was able to form SOAPEnvelope with the 'xml' format but I
am unable to find an API to invoke the service using the SOAPEnvelope that I
created.  please scroll down , you will see my sample client that I was
trying to write.


  Thanks
  Kiran
  -------------------------------------------------
  Ph: 312 742 9630
  Email: kkumar@objectwave.com


----------------------------------------------------------------------------
--
  From: Ephemeris Lappis [mailto:ephemeris.lappis@gmail.com]
  Sent: Tue 6/7/2005 12:37 PM
  To: axis-user@ws.apache.org
  Subject: RE: how to call a document style web service?


  Hello.
  I suppose that if you have the wsdl for your web service, you can generate
the client stubs, and use them to call it. If you want, you can also build a
call by yourself using dynamic invocation, setting appropriate style, etc.

  Here are few lines from an old test program that builds a literal call to
a service operation named "evaluate" that takes a string as argument and
also returns a string. You must adapt the namespaces, names, parameters and
endoint URL according to your real service. I'm not sure this code work as
is with recent versions, but this is a base idea... You must also take care
about the classes you use. In my example, it seems that i were using axis
specific classes (Call, Service), but i think it should be better to only
use the jaxrpc API to ensure future compliance...

  I hope this can help you...


  --
  Ephemeris Lappis 


    String endpoint =
"http://alhambra:9999/j2ee14-three-services-ejb/First-Class-WS/FirstClassWS"
;

    QName operationQName = new QName("http://ws.moon.net/three",
"evaluate");
    QName resultQName = new QName("http://ws.moon.net/three",
"evaluateReturn");

    Service service = new Service();
    Call call = (Call) service.createCall();

    call.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY, new
Boolean(true));
    call.setProperty(javax.xml.rpc.Call.OPERATION_STYLE_PROPERTY,
"literal");
    call.setProperty(javax.xml.rpc.Call.OPERATION_STYLE_PROPERTY,
"document");

    call.setTargetEndpointAddress(new java.net.URL(endpoint));
    call.setOperationName(operationQName);
    call.addParameter("evaluate", operationQName, String.class,
ParameterMode.IN);
    call.setReturnType(resultQName, String.class);

    Object[] input = { "Philippe" };

    Object result = call.invoke(input);

    -----Original Message-----
    From: Kiran Kumar [mailto:kkumar@objectwave.com]
    Sent: Tuesday, June 07, 2005 6:39 PM
    To: axis-user@ws.apache.org
    Subject: RE: how to call a document style web service?


    Hello all.. I am really stuck.. please point me to some example on how
to call webservice using soap envelope..  I searched through google, but
could not find any example...

    Thank You, Kiran

----------------------------------------------------------------------------
    From: Kiran Kumar [mailto:kkumar@objectwave.com]
    Sent: Tue 6/7/2005 8:15 AM
    To: axis-user@ws.apache.org
    Subject: how to call a document style web service?


    Helo all,

    I am using axis 1.2 (java).. I built a document style
    webservice, which has following method..

    public Geocode onfromto(OnfromtoInputs inputs);

    I started writing a client to call this web service
    method.. but I could not find any API to call a web
    service method with soap envelope.. can you please throw
    some light on this ... ?

    Thanks for your time, GK.

    ==== I started writing a client something like this..


    // create envelope
    SOAPEnvelope env = new SOAPEnvelope();

    // create body
    SOAPBody body = env.addBody();

    // Create body
    Name bodyName =
    env.createName("onfromto","m","http://mydomain.domain/onfromto");
    SOAPBodyElement bodyElement =
    body.addBodyElement(bodyName);

    Name nameAddress = env.createName("address");
    SOAPElement eleAddress =
    bodyElement.addChildElement(nameAddress);
    eleAddress.addTextNode("2425 springdale"); 

    Name nameGeoCodingTarget = env.createName("codingtarget");
    SOAPElement eleGeo =
    bodyElement.addChildElement(nameGeoCodingTarget);
    eleGeo.addTextNode("0"); 

    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(strEndpoint);

    How to invoke with soap envelop.... ?

    =====

    Thanks for your time
    Kiran

    ------------------------------------------------

    This e-mail, and any attachments thereto, is confidential and is
intended only for the individual(s) named.  If you are not the intended
recipient, please let us know by e-mail reply and delete it from your
system; do not copy/save this e-mail or disclose its contents to anyone.
E-mail transmissions cannot be guaranteed to be secure or error-free as the
transmission could be interrupted, corrupted, lost, destroyed, altered,
arrive late or contain viruses.  ObjectWave does not accept liability for
any errors or omissions in the contents of this e-mail which arise as a
result of e-mail transmission.  The views expressed in this e-mail do not
necessarily reflect those of ObjectWave or its affiliates.

    ------------------------------------------------

    ------------------------------------------------

    This e-mail, and any attachments thereto, is confidential and is
intended only for the individual(s) named.  If you are not the intended
recipient, please let us know by e-mail reply and delete it from your
system; do not copy/save this e-mail or disclose its contents to anyone.
E-mail transmissions cannot be guaranteed to be secure or error-free as the
transmission could be interrupted, corrupted, lost, destroyed, altered,
arrive late or contain viruses.  ObjectWave does not accept liability for
any errors or omissions in the contents of this e-mail which arise as a
result of e-mail transmission.  The views expressed in this e-mail do not
necessarily reflect those of ObjectWave or its affiliates.

    ------------------------------------------------


Mime
View raw message