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 Oliver Nautsch <o....@nautsch.com> on 2004/02/29 11:46:44 UTC

JavaBean as INOUT parameter

Hello,

I want to create a service with a JavaBean as an INOUT-parameter but I get the
following exception:

===============
java.lang.IllegalArgumentException: Illegal argument passed to
ParameterDesc.setJavaType.  The java type
org.dokustelle.model.work.Diplombereich does not match the mode inout
===============

My WSDD-file is:
===============
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <service name="PlaceService" provider="java:RPC">
  <parameter name="allowedMethods" value="*"/>
  <parameter name="className" value="org.dokustelle.services.PlaceService"/>
 </service>

 <service name="WorkService" provider="java:RPC">
    <parameter name="allowedMethods" value="*" />
    <parameter name="className" value="org.dokustelle.services.WorkService" />
    <parameter name="scope" value="request"/>

    <operation name="add" >
      <parameter name="diplombereich_1" mode="INOUT"/>
    </operation>
  </service>

 <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Diplombereich"
xmlns:DokuStelleNS="urn:DokuStelleService"
languageSpecificType="java:org.dokustelle.model.work.Diplombereich"/>
 <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Fachbereich"
xmlns:DokuStelleNS="urn:DokuStelleService"
languageSpecificType="java:org.dokustelle.model.work.Fachbereich"/>
 <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Arbeit"
xmlns:DokuStelleNS="urn:DokuStelleService"
languageSpecificType="java:org.dokustelle.model.work.Arbeit"/>
 <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Diplomarbeit"
xmlns:DokuStelleNS="urn:DokuStelleService"
languageSpecificType="java:org.dokustelle.model.work.Diplomarbeit"/>

</deployment>
===============

The implementation on the client side:
===============
...
    public void add(Diplombereich diplomBereich){
        Call call = axisConfig.getCall();
        call.setOperationName(new QName(serviceName, "add"));

        try {

            String param1_Name = "diplombereich_1";

            call.addParameter(param1_Name, buildQName(Diplombereich.class),
ParameterMode.INOUT );
            call.setReturnType(XMLType.AXIS_VOID);
            call.invoke(new Object[]{diplomBereich});

            Map ouputParams = call.getOutputParams();
...
===============

What is wrong?
Any information will be helpful,

Thanks
Oliver Nautsch



Automatic wsdl creation errors

Posted by Brian Shields <bg...@yahoo.com>.
Hi all,
i have had my service running for a while now with very few problems. But for some reason, within the wsdl file the namespace for my service has gone from
(url)/axis/services/myService to (url)/axis/services/myService/axis/services/myService. This is causing errors with the clients connecting to the service that use runtime stub generation. Is there a reason for this? All of axis default services have had this change made to them also!
Thanks,
Brian.



---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

Namespace errors

Posted by Brian Shields <bg...@yahoo.com>.
Hi all,
i have had my service running for a while now with very few problems. But for some reason, within the wsdl file the namespace for my service has gone from
(url)/axis/services/myService to (url)/axis/services/myService/axis/services/myService. This is causing errors with the clients connecting to the service that use runtime stub generation. Is there a reason for this? All of axis default services have had this change made to them also!
Thanks,
Brian.


---------------------------------
Do you Yahoo!?
Get better spam protection with Yahoo! Mail

Re: JavaBean as INOUT parameter

Posted by Oliver Nautsch <o....@nautsch.com>.
Hello,

i found the problem. A Service on the server side has to use a holder.

1.) Implement a holder class:
===============
public final class DiplombereichHolder implements javax.xml.rpc.holders.Holder{
    
    public Diplombereich value;
    
    public DiplombereichHolder(){
        
    }
    
    public DiplombereichHolder(Diplombereich value){
        this.value = value;
    }
}
===============
(It should be possible to generate this implementation from a WSDL.)

2.) Change the signature of the methode on the service/server side from

    public void add(Diplombereich diplomBereich)...
to 

    public void add(DiplombereichHolder diplomBereich)...

and it works!

Regards
Oliver Nautsch

Quoting Oliver Nautsch <o....@nautsch.com>:

> Hello,
> 
> I want to create a service with a JavaBean as an INOUT-parameter but I get
> the
> following exception:
> 
> ===============
> java.lang.IllegalArgumentException: Illegal argument passed to
> ParameterDesc.setJavaType.  The java type
> org.dokustelle.model.work.Diplombereich does not match the mode inout
> ===============
> 
> My WSDD-file is:
> ===============
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
> 
>  <service name="PlaceService" provider="java:RPC">
>   <parameter name="allowedMethods" value="*"/>
>   <parameter name="className" value="org.dokustelle.services.PlaceService"/>
>  </service>
> 
>  <service name="WorkService" provider="java:RPC">
>     <parameter name="allowedMethods" value="*" />
>     <parameter name="className" value="org.dokustelle.services.WorkService"
> />
>     <parameter name="scope" value="request"/>
> 
>     <operation name="add" >
>       <parameter name="diplombereich_1" mode="INOUT"/>
>     </operation>
>   </service>
> 
>  <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Diplombereich"
> xmlns:DokuStelleNS="urn:DokuStelleService"
> languageSpecificType="java:org.dokustelle.model.work.Diplombereich"/>
>  <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Fachbereich"
> xmlns:DokuStelleNS="urn:DokuStelleService"
> languageSpecificType="java:org.dokustelle.model.work.Fachbereich"/>
>  <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Arbeit"
> xmlns:DokuStelleNS="urn:DokuStelleService"
> languageSpecificType="java:org.dokustelle.model.work.Arbeit"/>
>  <beanMapping qname="DokuStelleNS:org.dokustelle.model.work.Diplomarbeit"
> xmlns:DokuStelleNS="urn:DokuStelleService"
> languageSpecificType="java:org.dokustelle.model.work.Diplomarbeit"/>
> 
> </deployment>
> ===============
> 
> The implementation on the client side:
> ===============
> ...
>     public void add(Diplombereich diplomBereich){
>         Call call = axisConfig.getCall();
>         call.setOperationName(new QName(serviceName, "add"));
> 
>         try {
> 
>             String param1_Name = "diplombereich_1";
> 
>             call.addParameter(param1_Name, buildQName(Diplombereich.class),
> ParameterMode.INOUT );
>             call.setReturnType(XMLType.AXIS_VOID);
>             call.invoke(new Object[]{diplomBereich});
> 
>             Map ouputParams = call.getOutputParams();
> ...
> ===============
> 
> What is wrong?
> Any information will be helpful,
> 
> Thanks
> Oliver Nautsch
> 
> 
>