Hi
I try to call a soap-service on an axis2 1.3 server with only one
string argument. The value of the string argument I get from a file
which is utf-8 encoded and contains special characters like "äöü".
I read the file as followed:
----------------------------
Reader in = new InputStreamReader(new FileInputStream(m_sUploadFile),
"UTF-8");
char[] chr = new char[(int)new File(m_sUploadFile).length()];
in.read(chr);
in.close();
String sArgument = new String(chr);
----------------------------
If I now call the service with sArgument as argument, I get ever the
error:
----------------------------
org.apache.axis2.AxisFault: Invalid null character in text to output
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:72)
at
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
----------------------------
This is my soap-client-code:
----------------------------
try {
RPCServiceClient sender = new RPCServiceClient();
Options options = sender.getOptions();
// Set the Server-Reference
EndpointReference targetEPR = new
EndpointReference(m_sCPSServerURL+"/CPSServerRedSys");
options.setTo(targetEPR);
// Set the operation to be called
QName op_xmlexport = new QName(CPSSERVER_NAMESPACE,
"redsysImportStructure");
// Set the parameters
Object[] opArgs = new Object[] { new String(sStructureXMLStream),
new Integer(iRedSysUserID)
};
Class[] returnTypes = new Class[] { String.class };
// Call WebService
Object[] response = sender.invokeBlocking(op_xmlexport, opArgs,
returnTypes);
// Read Return data
if(response[0] != null) {
String sResponse = response[0].toString();
if(sResponse.startsWith("CPS-Error: ")) {
oSB_ImportReport.append(sResponse.substring(sResponse.indexOf("CPS-Error:
")+11));
bOK = false;
} else {
oSB_ImportReport.append(response[0].toString());
}
}
} catch(AxisFault e) {
oSB_ImportReport.append("Error calling CPSServer: " +e.toString());
bOK = false;
}
----------------------------
Can anyone help?
Great thanks,
--
Oliver Hirschi
http://www.FamilyHirschi.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]