axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Meier (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-1781) MarshalException, when calling AXIS webservice function from J2ME
Date Wed, 26 Jan 2005 15:56:21 GMT
MarshalException, when calling AXIS webservice function from J2ME
-----------------------------------------------------------------

         Key: AXIS-1781
         URL: http://issues.apache.org/jira/browse/AXIS-1781
     Project: Axis
        Type: Bug
  Components: WSDL processing  
    Versions: 1.1    
 Environment: Windows XP SP1, Tomcat 5, Sun WTK 2.1, Axis 1.1, J2ME, JSR-172
    Reporter: Paul Meier
 Attachments: WSTest WTKProject.rar, hallo.class, hallo.jws, hallo.wsdl

Hallo,

I'm a beginner to webservices with Apache Axis. For a project with J2ME that should use webservice
functions I wanted to test an little webservice with Axis and the Sun WTK 2.1.

The name of the test class is hallo.java and was renamed to hallo.jws and placed in the webapps\axis
folder of Tomcat.
It contains following code: 

public class hallo {
	public int hallo2(String input, int i) {
	System.out.println("input " + input + " " + i);
 	return (i);
	}
} 

Nothing special as you see. The testing of this service in a java client on pc worked fine,
after creating the needed stubs of course. 

To generate the doc/lit style WSDL file for the Sun WTK 2.1 stub generator I used folowing
command  

java -cp ".\axis.jar;.\commons-logging.jar;.\commons-discovery.jar;.\saaj.jar;.\wsdl4j.jar;.\jaxrpc.jar;."
org.apache.axis.wsdl.Java2WSDL -l "http://localhost:8080/axis/hallo.jws" -y WRAPPED -u LITERAL
hallo

That worked fine and the wsdl file with following content was created: 

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace" xmlns:impl="http://DefaultNamespace"
xmlns:intf="http://DefaultNamespace" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
 <wsdl:types>
  <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://DefaultNamespace">
   <element name="hallo2">
    <complexType>
     <sequence>
      <element name="input" type="xsd:string"/>
      <element name="i" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="hallo2Response">
    <complexType>
     <sequence>
      <element name="hallo2Return" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="hallo2Request">

      <wsdl:part name="parameters" element="impl:hallo2"/>

   </wsdl:message>

   <wsdl:message name="hallo2Response">

      <wsdl:part name="parameters" element="impl:hallo2Response"/>

   </wsdl:message>

   <wsdl:portType name="hallo">

      <wsdl:operation name="hallo2" parameterOrder="">

         <wsdl:input name="hallo2Request" message="impl:hallo2Request"/>

         <wsdl:output name="hallo2Response" message="impl:hallo2Response"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="halloSoapBinding" type="impl:hallo">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="hallo2">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="hallo2Request">

            <wsdlsoap:body use="literal" namespace="http://DefaultNamespace"/>

         </wsdl:input>

         <wsdl:output name="hallo2Response">

            <wsdlsoap:body use="literal" namespace="http://DefaultNamespace"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="halloService">

      <wsdl:port name="hallo" binding="impl:halloSoapBinding">

         <wsdlsoap:address location="http://localhost:8080/axis/hallo.jws"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>


The stub generation generated the needed stubs for the midlet, but 2 errors occured: 

warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit for soapbind:body:
"hallo2"

warning: R2716 WSI-BasicProfile ver. 1.0, namespace attribute not allowed in doc/lit for soapbind:body:
"hallo2"


The deletion of " namespace="http://DefaultNamespace" " in the wsdl file led to stub generation
of "hallostub" in src folder without am error message.

The midlet source WSTest.java is almost the same like the example of AxisUserTest last year.
The only changes are the 
import of the hallostub package, the creation of an object of class Hallo named hallo and
initialized with hallo = new Hallo_Stub(); and the function call 
int result = hallo.hallo2("GoodMorning!", 6);
System.out.println("Ergebnis: " + result);
String text = "Result is " + result + ".";
Alert a = new Alert("Result", text, null, AlertType.CONFIRMATION); .

The compilation and packaging (with j2me-ws.jar in lib) worked fine but in neither the SUN
emulator or other emulators like Siemens CX65 or Nokia S40 or S60, the response to the webservice
could be received.  

For instance the Sun emulator sais after calling the service:

java.rmi.MarshalException: Invalid Element in Response: hallo2Return
	at hallostub.Hallo_Stub.hallo2(+82)
	at WSTest.run(+13)


The tomcat output windows shows after calling the service: 
input GoodMorning! 6 

I conclude that the webservice has been called correctly, but the answer can not be understood
by the midlet. 
How can this be solved?

Thank you very much for your help.

Paul


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message