axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon West <simonwes...@web.de>
Subject RE: envelop null. how to invoke an axis 2 method?
Date Tue, 01 Aug 2006 20:51:05 GMT
Hi Nirmit,
thank you very much. It works.

Best regards
Simon

> -----Urspr√ľngliche Nachricht-----
> Von: axis-user@ws.apache.org
> Gesendet: 01.08.06 21:40:13
> An: axis-user@ws.apache.org
> Betreff: RE: envelop null. how to invoke an axis 2 method?


> Hi,
> 
> I have recently ran into this problem and I am confident it is a WSDL2Java
> bug. When a WSDL has an operation without argument, i.e., its input is an
> empty message, the generated Stub class has this bug: it declares an
> envelope variable initlaized with null, and then doesn't assign an empty
> body to it.
> 
> To fix this, add this line immediately after env is declared in the
> corresponding service operation method stub:
> 
> env=toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()));
> 
> 
> This should solve your problem.
> 
> Thanks,
> 
> -Nirmit
> 
> 
> 
>                                                                            
>              "Derek"                                                       
>              <derek-axis@crc-c                                             
>              orp.com>                                                   To 
>                                        <axis-user@ws.apache.org>           
>              08/01/2006 02:58                                           cc 
>              PM                                                            
>                                                                    Subject 
>                                        RE: envelop null. how to invoke an  
>              Please respond to         axis 2 method?                      
>              axis-user@ws.apac                                             
>                   he.org                                                   
>                                                                            
>                                                                            
>                                                                            
>                                                                            
> 
> 
> 
> 
> Simon:
> 
> Generated code might legitimately throw either IllegalArgumentExceptions or
> IllegalStateExceptions with appropriately descriptive error messages, but
> if
> it's throwing a descriptionless NullPointerException, it has a bug in it.
> Even if you eventually find a workaround, please file a JIRA for this issue
> so that the code gets fixed.
> 
> Thanks.
> 
> Derek
> 
> > -----Original Message-----
> > From: Simon West [mailto:simonwest80@web.de]
> > Sent: Tuesday, August 01, 2006 11:40 AM
> > To: axis-user@ws.apache.org
> > Subject: Re: envelop null. how to invoke an axis 2 method?
> >
> >
> > Thanks for the fast answer, but its the same problem. I added:
> >
> > <wsdl:message name="GetCategoriesRequest"/>
> >
> > to my wsdl.  But an invokation produces:
> >
> > java.lang.NullPointerException
> >            at
> > org.apache.axis2.context.MessageContext.setEnvelope(MessageCon
> > text.java:681)
> >            at
> > org.apache.axis2.ProductStub.GetCategories(ProductStub.java:119)
> >            at ProductTest.main(ProductTest.java:10)
> >
> > Here is the new WSDL again:
> >
> > <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >            xmlns:tns="http://www.example.org/Product/"
> >            xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> >            xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> >            xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> >            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >            xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >            targetNamespace="http://www.example.org/Product/">
> >            <wsdl:types>
> >                        <xsd:schema
> > targetNamespace="http://www.example.org/Product/"
> >                                    elementFormDefault="unqualified"
> >                                    attributeFormDefault="unqualified">
> >                                    <xsd:element name="Categories">
> >                                                <xsd:complexType>
> >                                                            <xsd:sequence>
> >
> <xsd:element
> > type="xsd:string" name="Category"
> >
> 
> > maxOccurs="unbounded" />
> >
> </xsd:sequence>
> >                                                </xsd:complexType>
> >                                    </xsd:element>
> >                        </xsd:schema>
> >            </wsdl:types>
> >            <wsdl:message name="GetCategoriesRequest" />
> >            <wsdl:message name="GetCategoriesResponse">
> >                        <wsdl:part element="tns:Categories" name="part1"
> />
> >            </wsdl:message>
> >            <wsdl:portType name="ProductPortType">
> >                        <wsdl:operation name="GetCategories">
> >                                    <wsdl:input
> > message="tns:GetCategoriesRequest" />
> >                                    <wsdl:output
> > message="tns:GetCategoriesResponse" />
> >                        </wsdl:operation>
> >            </wsdl:portType>
> >            <wsdl:binding type="tns:ProductPortType"
> >                        name="ProductSOAP11Binding">
> >                        <soap:binding style="document"
> >
> > transport="http://schemas.xmlsoap.org/soap/http" />
> >                        <wsdl:operation name="GetCategories">
> >                                    <soap:operation style="document"
> >
> > soapAction="http://www.example.org/Product/GetCategories" />
> >                                    <wsdl:input>
> >                                                <soap:body
> > namespace="http://www.example.org/Product/"
> >                                                            use="literal"
> />
> >                                    </wsdl:input>
> >                                    <wsdl:output>
> >                                                <soap:body
> > namespace="http://www.example.org/Product/"
> >                                                            use="literal"
> />
> >                                    </wsdl:output>
> >                        </wsdl:operation>
> >            </wsdl:binding>
> >            <wsdl:binding type="tns:ProductPortType"
> >                        name="ProductSOAP12Binding">
> >                        <soap12:binding style="document"
> >
> > transport="http://schemas.xmlsoap.org/soap/http" />
> >                        <wsdl:operation name="GetCategories">
> >                                    <soap12:operation style="document"
> >
> > soapAction="http://www.example.org/Product/GetCategories" />
> >                                    <wsdl:input>
> >                                                <soap12:body
> > namespace="http://www.example.org/Product/"
> >                                                            use="literal"
> />
> >                                    </wsdl:input>
> >                                    <wsdl:output>
> >                                                <soap12:body
> > namespace="http://www.example.org/Product/"
> >                                                            use="literal"
> />
> >                                    </wsdl:output>
> >                        </wsdl:operation>
> >            </wsdl:binding>
> >            <wsdl:service name="Product">
> >                        <wsdl:port binding="tns:ProductSOAP11Binding"
> >                                    name="ProductSOAP11port0">
> >                                    <soap:address
> >
> > location="http://localhost:8080/axis2/services/Product" />
> >                        </wsdl:port>
> >                        <wsdl:port binding="tns:ProductSOAP12Binding"
> >                                    name="ProductSOAP12port0">
> >                                    <soap12:address
> >
> > location="http://localhost:8080/axis2/services/Product" />
> >                        </wsdl:port>
> >            </wsdl:service>
> > </wsdl:definitions>
> >
> > Simon
> >
> >
> > > -----Urspr√ľngliche Nachricht-----
> > > Von: axis-user@ws.apache.org
> > > Gesendet: 01.08.06 19:28:28
> > > An: axis-user@ws.apache.org
> > > Betreff: Re: envelop null. how to invoke an axis 2 method?
> >
> >
> > > You must define a <wsdl:message> for your request message,
> > even if you
> > > have no arguments. In that case, you just define an empty message,
> > > e.g.,
> > >
> > >      <wsdl:message name="GetCategoriesRequest"/>
> > >
> > > Anne
> > >
> > >
> > > On 8/1/06, Simon West <simonwest80@web.de> wrote:
> > > > Hello,
> > > > i build my first webservice and i got a big problem. I
> > modified the
> > > > \samples\wsdl\perf.wsdl. I want to make a method which has no
> > > > arguments an retrieves an list of strings. I generated
> > the classes
> > > > and deployed the service. Now the problem is that i cant
> > invoke my
> > > > method. I get this exception:
> > > >
> > > > public static void main(String[] args) {
> > > >                 try {
> > > >                         ProductStub ps = new ProductStub();
> > > >                         ps.GetCategories();
> > > >                 } catch (Exception e) {
> > > >                         e.printStackTrace();
> > > >                 }
> > > >         }
> > > >
> > > > produces
> > > >
> > > > java.lang.NullPointerException
> > > >         at
> > org.apache.axis2.context.MessageContext.setEnvelope(MessageCon
> > text.java:681)
> > > >         at
> > testclient.org.apache.axis2.ProductStub.GetCategories(ProductS
> > tub.java:109)
> > > >         at testclient.ProductTest.main(ProductTest.java:14)
> > > >
> > > > But i have already implemented the server side as:
> > > >
> > > > public class ProductSkeleton {
> > > >
> > > >         public org.example.www.product.Categories GetCategories()
> > > >         {
> > > >                 Categories c = new Categories();
> > > >                 c.addCategory("hello");
> > > >                 c.addCategory("cya");
> > > >                 return c;
> > > >         }
> > > > }
> > > >
> > > > The wsdl is a little bit longer but maybe helpfull:
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <wsdl:definitions
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > >         xmlns:tns="http://www.example.org/Product/"
> > > >         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > >         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > name="Product"
> > > >         targetNamespace="http://www.example.org/Product/">
> > > >         <wsdl:types>
> > > >                 <xsd:schema
> > targetNamespace="http://www.example.org/Product/">
> > > >                         <xsd:element name="Categories">
> > > >                                 <xsd:complexType>
> > > >                                         <xsd:sequence>
> > > >
> > <xsd:element name="Category" type="xsd:string"
> > > >
> > minOccurs="1" maxOccurs="unbounded">
> > > >                                                 </xsd:element>
> > > >                                         </xsd:sequence>
> > > >                                 </xsd:complexType>
> > > >                         </xsd:element>
> > > >                 </xsd:schema>
> > > >         </wsdl:types>
> > > >         <wsdl:message name="GetCategoriesResponse">
> > > >                 <wsdl:part element="tns:Categories"
> > > >                         name="GetCategoriesResponse" />
> > > >         </wsdl:message>
> > > >         <wsdl:portType name="Product">
> > > >                 <wsdl:operation name="GetCategories">
> > > >                         <wsdl:input
> > message="tns:GetCategoriesRequest" />
> > > >                         <wsdl:output
> > message="tns:GetCategoriesResponse" />
> > > >                 </wsdl:operation>
> > > >         </wsdl:portType>
> > > >         <wsdl:binding name="ProductSOAP" type="tns:Product">
> > > >                 <soap:binding style="document"
> > > >
> > transport="http://schemas.xmlsoap.org/soap/http" />
> > > >                 <wsdl:operation name="GetCategories">
> > > >                         <soap:operation
> > > >
> > soapAction="http://www.example.org/Product/GetCategories" />
> > > >                         <wsdl:input>
> > > >                                 <soap:body
> > parts="GetCategoriesRequest" use="literal" />
> > > >                         </wsdl:input>
> > > >                         <wsdl:output>
> > > >                                 <soap:body
> > parts="GetCategoriesResponse" use="literal" />
> > > >                         </wsdl:output>
> > > >                 </wsdl:operation>
> > > >         </wsdl:binding>
> > > >         <wsdl:service name="Product">
> > > >                 <wsdl:port binding="tns:ProductSOAP"
> > name="ProductSOAP">
> > > >                         <soap:address
> > location="http://www.example.org/" />
> > > >                 </wsdl:port>
> > > >         </wsdl:service>
> > > > </wsdl:definitions>
> > > >
> > > > Maybe someone can help me how to invoke this method?
> > > >
> > > > Best regards
> > > > Simon
> > > >
> > ____________________________________________________________________
> > > > _
> > > > Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer
> > Onlinekosten zu sparen!
> > > > http://smartsurfer.web.de/?mc=100071&distributionid=000000000071
> > > >
> > > >
> > > >
> > --------------------------------------------------------------------
> > > > -
> > > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> >
> >
> > ______________________________________________________________
> > Verschicken Sie romantische, coole und witzige Bilder per
> > SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 


_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071


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


Mime
View raw message