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 "Miller, Janet" <Mi...@pbworld.com> on 2005/07/06 00:06:31 UTC

First Web Service

I have a basic question about creating a web service.  I'm creating my
very first one 
and I'm starting with wsdl that was generated from an outside source.  I
used wsdl2java to 
generate the client stub and skeleton code.  It generated a
TZCServiceSoapImpl.java file.  
I modified that file to return a simple string from each of the methods
so that I could 
test a simple web service.  I then deployed the TZCServiceSoapImpl file.
Is that what I 
was supposed to deploy?  If so, I don't see how the
TZCServiceSoapSkeleton is used.  I 
don't see anything that calls it.  Did I do the correct steps?  It's not
working.

Jan

Re: apachesoap:Map

Posted by Anne Thomas Manes <at...@gmail.com>.
Paul,

Your first problem is that you are trying to return a collection from
a web service. You shouldn't do this. You should convert all
collections in your interfaces to arrays. Otherwise, only Java
environments will be able to reliably consume your service.

Anne

On 7/6/05, Paul I Fodor <pi...@us.ibm.com> wrote:
> 
> Hi, 
>  I have a web service that returns a hash map 
> The method: 
> 
>  public HashMap getPrompts(String diSta){ 
>    .......... 
>     return c.getPrompts(); 
>   } 
> 
> The WSDL: 
>    <wsdl:message name="getPromptsResponse"> 
>       <wsdl:part name="getPromptsReturn" type="apachesoap:Map"/> 
>    </wsdl:message> 
> 
> The client: 
>   public HashMap getPrompts(){ 
>     try{ 
>       Service  service = new Service(); 
>       Call call = (Call) service.createCall(); 
>   
>       call.setTargetEndpointAddress( new java.net.URL(endpoint) ); 
>       call.setOperationName( "getPrompts" ); 
>       call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN ); 
>       call.setReturnType( ??????????????????????????); 
>   
>       return (HashMap)(call.invoke( new Object [] { this.id })); 
>     }catch(Exception e){ 
>       e.printStackTrace();   
>       return null; 
>     } 
>   } 
> 
> My question is what type I put in       call.setReturnType(
> ??????????????????????????) ? 
> 
> Thanks, 
>  Paul.

apachesoap:Map

Posted by Paul I Fodor <pi...@us.ibm.com>.
Hi,
 I have a web service that returns a hash map
The method:

 public HashMap getPrompts(String diSta){
   ..........
    return c.getPrompts();
  }

The WSDL: 
   <wsdl:message name="getPromptsResponse">
      <wsdl:part name="getPromptsReturn" type="apachesoap:Map"/>
   </wsdl:message>

The client:
  public HashMap getPrompts(){
    try{
      Service  service = new Service();
      Call call = (Call) service.createCall();
 
      call.setTargetEndpointAddress( new java.net.URL(endpoint) );
      call.setOperationName( "getPrompts" );
      call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN );
      call.setReturnType( ??????????????????????????);
 
      return (HashMap)(call.invoke( new Object [] { this.id }));
    }catch(Exception e){
      e.printStackTrace(); 
      return null;
    }
  }

My question is what type I put in       call.setReturnType( 
??????????????????????????) ?

Thanks,
 Paul.

Re: First Web Service

Posted by Paul I Fodor <pi...@us.ibm.com>.
You deploy the TZCServiceSoapSkeleton

Look over: 
http://ws.apache.org/axis/java/user-guide.html#Java2WSDLBuildingWSDLFromJava

That is example6 in the userguide and it seems to be what you whant to do.

Paul Fodor.




"Miller, Janet" <Mi...@pbworld.com> 
07/05/2005 06:06 PM
Please respond to
axis-user


To
<ax...@ws.apache.org>
cc

Subject
First Web Service






I have a basic question about creating a web service.  I'm creating my
very first one 
and I'm starting with wsdl that was generated from an outside source.  I
used wsdl2java to 
generate the client stub and skeleton code.  It generated a
TZCServiceSoapImpl.java file. 
I modified that file to return a simple string from each of the methods
so that I could 
test a simple web service.  I then deployed the TZCServiceSoapImpl file.
Is that what I 
was supposed to deploy?  If so, I don't see how the
TZCServiceSoapSkeleton is used.  I 
don't see anything that calls it.  Did I do the correct steps?  It's not
working.

Jan