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 Paul I Fodor <pi...@us.ibm.com> on 2005/07/06 15:48:17 UTC

apachesoap:Map

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: 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.