Kartik,

The problem is in your WSDL message definition. When using document/literal, your message definition should contain only one body part. (You can define additional parts, but they should represent header blocks -- not separate parameters in your body.) Axis ignores the second part.

You need to define a wrapper element for your input message. If you give that wrapper element the same name as the operation name, you're using the "wrapped" programming convention, and it will automatically marshal your parameters for you.:

          <types>
                <schema targetNamespace="http://ka.apache.org/types";
                        xmlns="http://www.w3.org/2001/XMLSchema";
                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>

                        <element name="foo" type="xsd:string" />
                        <element name="bar" type="xsd:string" />
                        <element name="wow" type="xsd:string" />
                                  <element name="testTwo">
                                      <complexType>
                                          <sequence>
                                              <element ref="xsd1:foo"/>
                                              <element ref="xsd1:bar"/>
                                           </sequence>
                                      </complexType>
                                 </element>
                </schema>
        </types>

        <message name="testTwoIn">
                <part name="body" element="xsd1:testTwo" />
        </message>
        <message name="testTwoOut">
                <part name="w" element="xsd1:wow" />
        </message>


At 04:24 PM 3/11/2004, Kartik wrote:
Hi Folks.

I have attached the very simple WSDL (paramtest.wsdl)
that I am testing with.  I have a couple of issues and
it would be great if someone can point some
solutions/references.

In my WSDL, I have a single operation as shown belo
(java mapping):

String testTwo(String f, String b);

The operation takes two Strings and returns the
"hello" back.

I run a simple C#.NET client (I also tried IONA Artix
C++ clients with the same results) which creates a
proxy and calls:

  ParamTestService service = new ParamTestService();
  string result = service.testTwo("abcd", "wxyz");

When I try to invoke on the operation, I can see on
the Tomcat console, that only the first argument
("abcd") reaches the service.  The second argument
never reaches the service!  If I do a
System.out.println on f and b in my operation
implementation, I see "abcd" for f (first arg), but I
see 'null' for b (second arg)!

Does anyone know of any such issues or if you can find
a problem in my WSDL, that would be too good.  But I
think my WSDL looks okay, because other WebService
tool-kits to build my service and tested the
interoperability (.NET (C#), Artix (C++), XMLBus
(Java)), the same WSDL can generate the servers and
clients fine with correct invocations on all
cross-combinations.  It seems that only Axis is having
some problems :(

PS: I looked at the request SOAP message received by
Axis, and it DOES have the second argument's value -
but somewhere in reading the incoming message or
parsing it, it loses the second argument.

Please try out the service - it will not take more
than 10 minutes ... See steps below:

- Copy the WSDL to a temp location
- Generate the server side code:
java org.apache.axis.wsdl.WSDL2Java -s -a
paramtest.wsdl
- Provides a sample implementation of the
org/apache/ka/ParamTestImpl.java methods.
- Build and deploy the service on Tomcat.
- Generate client code using the local/deployed WSDL.
- Build and run the client to invoke the method
testTwo().
- See the SOAP messages and the behavior or the
service

Thank you ...
Kartik

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you're looking for faster
http://search.yahoo.com<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ParamTest"
        targetNamespace="http://ka.apache.org/";
        xmlns="http://schemas.xmlsoap.org/wsdl/";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
        xmlns:tns="http://ka.apache.org/";
        xmlns:xsd1="http://ka.apache.org/types";>
        <types>
                <schema targetNamespace="http://ka.apache.org/types";
                        xmlns="http://www.w3.org/2001/XMLSchema";
                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>

                        <element name="foo" type="xsd:string" />
                        <element name="bar" type="xsd:string" />
                        <element name="wow" type="xsd:string" />
                </schema>
        </types>

        <message name="testTwoIn">
                <part name="f" element="xsd1:foo" />
                <part name="b" element="xsd1:bar" />
        </message>
        <message name="testTwoOut">
                <part name="w" element="xsd1:wow" />
        </message>

        <portType name="ParamTestInterface">
                <operation name="testTwo">
                        <input message="tns:testTwoIn" name="testTwoIn" />
                        <output message="tns:testTwoOut" name="testTwoOut" />
                </operation>
        </portType>

<binding name="ParamTest" type="tns:ParamTestInterface">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>


                <operation name="testTwo">
                        <soap:operation soapAction="" style="document" />
                        <input message="tns:testTwoIn" name="testTwoIn">
                                <soap:body use="literal"/>
                        </input>
                        <output message="tns:testTwoOut" name="testTwoOut">
                                <soap:body use="literal"/>
                        </output>
                </operation>
        </binding>

<service name="ParamTestService">
<port name="ParamTestPort" binding="tns:ParamTest">
<soap:address location="http://localhost:8080/axis/services/ParamTestPort"/>
</port>
</service>
</definitions>

~~~~~~~~~~~~~~~~~~
Anne Thomas Manes
VP & Research Director
Burton Group




Reply via email to