• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Custom class with byte[]

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">

<wsdl:operation name="dosomething">

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

</wsdl:input>

<wsdl:output message="impl:dosomethingResponse" name="dosomethingResponse">

</wsdl:output>

</wsdl:operation>

</wsdl:portType>

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

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

<wsdl:operation name="dosomething">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="dosomethingRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="dosomethingResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</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>


 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic