Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom class with byte[]  RSS feed

 
Frank Saar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to create Web Services with Eclipse (Java Runtime 7 (also tried 8) Tomcat 7 (also tried 8).

Web Service with parameter "byte[]" and return value "byte[]" works fine.
Web Service with parameter "myOwnClass" and return value "myOwnClass" works also fine.
But if I have a "byte[]" element in "myOwnClass" and I run my Client test program I get the following error:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.NumberFormatException: For input string: "MTExMTExMTExMQ=="

Why? I don't have any numeric element (such as int ...) in my class members!?

Thanks and regards

Frank
 
Vijitha Kumara
Bartender
Posts: 3973
24
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

You may need to post your client code and any related classes to see what exactly is wrong.
 
Frank Saar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my Communication class "Commu.java":
package webservice;
public class Commu {
public String requestid;
public String datetime;
public byte[] payload;
}

My Webservice class "TestE.java":
package webservice;
@javax.jws.WebService
public class TestE {
@javax.jws.WebMethod
public void dosomething(Commu input) {
System.out.println(input.requestid);
return ;
}
}

And my Testclient (in another project) "TestEClient.java":
package webservice;
import java.rmi.RemoteException;
public class TestEClient {

public static void main(String[] args){
String result = "";
try {
TestEProxy endpoint = new TestEProxy("http://localhost:8080/TestE/services/TestE");
TestE service = endpoint.getTestE();
Commu inp = new Commu();
inp.setRequestid("RequestID000");
inp.setDatetime("00000");
byte[] payl = new byte[] {'A','A','A','A','A'};
inp.setPayload(payl);
service.dosomething(inp);

} catch (RemoteException e){
e.printStackTrace();
}
System.out.println(result);
}
}

And my WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservice" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice" xmlns:intf="http://webservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://webservice" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="dosomething">
<complexType>
<sequence>
<element name="input" type="impl:Commu"/>
</sequence>
</complexType>
</element>
<complexType name="Commu">
<sequence>
<element name="requestid" nillable="true" type="xsd:string"/>
<element name="datetime" nillable="true" type="xsd:string"/>
<element name="payload" nillable="true" type="xsd:base64Binary"/>
</sequence>
</complexType>
<element name="dosomethingResponse">
<complexType/>
</element>
</schema>
</wsdl:types>

<wsdl:message name="dosomethingResponse">

<wsdl:part element="impl:dosomethingResponse" name="parameters">

</wsdl:part>

</wsdl:message>

<wsdl:message name="dosomethingRequest">

<wsdl:part element="impl:dosomething" name="parameters">

</wsdl:part>

</wsdl:message>

<wsdl:portType name="TestE">

<wsdlperation name="dosomething">

<wsdl:input message="impl:dosomethingRequest" name="dosomethingRequest">

</wsdl:input>

<wsdlutput message="impl:dosomethingResponse" name="dosomethingResponse">

</wsdlutput>

</wsdlperation>

</wsdl:portType>

<wsdl:binding name="TestESoapBinding" type="impl:TestE">

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

<wsdlperation name="dosomething">

<wsdlsoapperation soapAction=""/>

<wsdl:input name="dosomethingRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdlutput name="dosomethingResponse">

<wsdlsoap:body use="literal"/>

</wsdlutput>

</wsdlperation>

</wsdl:binding>

<wsdl:service name="TestEService">

<wsdl:port binding="impl:TestESoapBinding" name="TestE">

<wsdlsoap:address location="http://localhost:8080/TestE/services/TestE"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!