You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by loredana loredana <lo...@yahoo.com> on 2007/10/08 11:27:30 UTC

simplest example pls help

I am strugling for a couple of days now to do the most simplest web service client using a web service on w3schools as test.

http://www.w3schools..com/webservices/tempconvert.asmx 

This is the web service. has 2 possible operations with one parameter. Can't get any simpler than this. Yet, I can't make a client for it. I already wrote about this problems couple of days ago, but I got nowhere. so this is what I tried:

try{

    String endpoint =
              "http://www.w3schools.com/webservices/tempconvert.asmx";;
   
          Service  service = new Service();
          Call     call    = (Call) service.createCall();
    
          call.setTargetEndpointAddress( new java.net.URL(endpoint) );
          call.setOperationName(new QName("http://tempuri.org";, "CelsiusToFahrenheit"));
         
          String ret = (String) call.invoke( new Object[] { "10" } );
   
          System.out.println("result: " + ret + "'");}
        catch{}

this should work but I keep getting 
"Server did not recognize the value of HTTP Header SOAPAction: ."

can any of you give this a try?? for someone with experience in axis this shouldn't take more than 5 min to try. I have a eclipse plugin that generates a web service client based on the wsdl but I don't want to "cheat"! I want to do it myself but i'm stuck. any help would be appreciated it!!




      ____________________________________________________________________________________
Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.
http://tv.yahoo.com/ 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: simplest example pls help

Posted by "Sree Vinayak.B" <bv...@gmail.com>.
try replacing

call.setOperationName(new QName("http://tempuri.org";,
"CelsiusToFahrenheit"));

with

call.setOperationName(new QName(endpoint, "CelsiusToFahrenheit"));


(ie) pass the endpoint as a parameter to QName class

regards,
Vinayak


On 10/8/07, Upul Godage <up...@gmail.com> wrote:
>
> Hi,
>
> Add this line and try.
>
> call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> call.setOperationName(new QName(" http://tempuri.org";,
> "CelsiusToFahrenheit"));
>
> call.setSOAPActionURI("http://tempuri.org/CelsiusToFahrenheit ");
>
> Also checkout Axis2 if you are starting out.
> http://ws.apache.org/axis2/
>
> Upul
>
>
> On 10/8/07, loredana loredana <lo...@yahoo.com> wrote:
> >
> > I am strugling for a couple of days now to do the most simplest web
> > service client using a web service on w3schools as test.
> >
> > http://www.w3schools..com/webservices/tempconvert.asmx
> >
> > This is the web service. has 2 possible operations with one parameter.
> > Can't get any simpler than this. Yet, I can't make a client for it. I
> > already wrote about this problems couple of days ago, but I got nowhere. so
> > this is what I tried:
> >
> > try{
> >
> >     String endpoint =
> >               "http://www.w3schools.com/webservices/tempconvert.asmx";;
> >
> >           Service  service = new Service();
> >           Call     call    = (Call) service.createCall();
> >
> >           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> >           call.setOperationName(new QName("http://tempuri.org ";,
> > "CelsiusToFahrenheit"));
> >
> >           String ret = (String) call.invoke( new Object[] { "10" } );
> >
> >           System.out.println("result: " + ret + "'");}
> >         catch{}
> >
> > this should work but I keep getting
> > "Server did not recognize the value of HTTP Header SOAPAction: ."
> >
> > can any of you give this a try?? for someone with experience in axis
> > this shouldn't take more than 5 min to try. I have a eclipse plugin that
> > generates a web service client based on the wsdl but I don't want to
> > "cheat"! I want to do it myself but i'm stuck. any help would be appreciated
> > it!!
> >
> >
> >
> >
> >
> >       ____________________________________________________________________________________
> > Tonight's top picks. What will you watch tonight? Preview the hottest
> > shows on Yahoo! TV.
> > http://tv.yahoo.com/
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>


-- 
Vinayak
http://tinyurl.com/22ph2e

Re: simplest example pls help

Posted by Upul Godage <up...@gmail.com>.
Hi,

Add this line and try.

call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://tempuri.org";,
"CelsiusToFahrenheit"));

call.setSOAPActionURI("http://tempuri.org/CelsiusToFahrenheit");

Also checkout Axis2 if you are starting out.
http://ws.apache.org/axis2/

Upul


On 10/8/07, loredana loredana <lo...@yahoo.com> wrote:
>
> I am strugling for a couple of days now to do the most simplest web
> service client using a web service on w3schools as test.
>
> http://www.w3schools..com/webservices/tempconvert.asmx
>
> This is the web service. has 2 possible operations with one parameter.
> Can't get any simpler than this. Yet, I can't make a client for it. I
> already wrote about this problems couple of days ago, but I got nowhere. so
> this is what I tried:
>
> try{
>
>     String endpoint =
>               "http://www.w3schools.com/webservices/tempconvert.asmx";;
>
>           Service  service = new Service();
>           Call     call    = (Call) service.createCall();
>
>           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
>           call.setOperationName(new QName("http://tempuri.org";,
> "CelsiusToFahrenheit"));
>
>           String ret = (String) call.invoke( new Object[] { "10" } );
>
>           System.out.println("result: " + ret + "'");}
>         catch{}
>
> this should work but I keep getting
> "Server did not recognize the value of HTTP Header SOAPAction: ."
>
> can any of you give this a try?? for someone with experience in axis this
> shouldn't take more than 5 min to try. I have a eclipse plugin that
> generates a web service client based on the wsdl but I don't want to
> "cheat"! I want to do it myself but i'm stuck. any help would be appreciated
> it!!
>
>
>
>
>
>       ____________________________________________________________________________________
> Tonight's top picks. What will you watch tonight? Preview the hottest
> shows on Yahoo! TV.
> http://tv.yahoo.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>