C++Builder. Now I want to communicate with Java (C++Builder Server -
Java Client). I am using the AXIS JAX-RPC implementation. After generating the Java file from the WSDL file I specify:
ITestServiceservice lService = new ITestServiceservice_Impl(); ITestService lPort = lService.getITestServicePort();
TSampleStruct lSampleStruct = new TSampleStruct(); lSampleStruct.setFirstName("Roland");
TSampleStruct lReceivedSampleStruct = lPort.echoStruct(lSampleStruct); String lFirstName = lReceivedSampleStruct.getFirstName(); System.out.println(lFirstName);
While the Borland C++ client is working the Java Version generates an Exception:
Exception in thread "main" java.rmi.RemoteException: Runtime exception;
nested exception is:
deserialization error: unexpected XML reader state. expected: END but
found: START: {urn:TestService}TSampleStruct
at
com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingS
ender.java:318)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:300)
at
com.tripleeye.soap.client.ITestService_Stub.echoStruct(ITestService_Stub.java:7
0)
at com.tripleeye.soap.client.TestClient.<init>(TestClient.java:30)
at com.tripleeye.soap.client.TestClient.main(TestClient.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Caused by: deserialization error: unexpected XML reader state. expected:
END but found: START: {urn:TestService}TSampleStruct
at
com.sun.xml.rpc.encoding.ObjectSerializerBase.deserialize(ObjectSerializerBase.
java:233)
at
com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.deserialize(ReferenceableS
erializerImpl.java:155)
at
com.tripleeye.soap.client.ITestService_Stub._deserialize_echoStruct(ITestServic
e_Stub.java:280)
at
com.tripleeye.soap.client.ITestService_Stub._readFirstBodyElement(ITestService_
Stub.java:258) at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:215) ... 8 more
The reply from the Borland C++ server was:
HTTP/1.1 200 OK Content-Type: text/xml Content-Length: 723 Content:
<?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:e choStructResponse xmlns:NS1="urn:TestService-ITestService" xmlns:NS2="urn:TestService"><return href="#1"/><NS2:TSampleStruct id="1" xsi:type="NS2:TSampleStruct"><LastName xsi:type="xsd:string"></LastName><FirstName xsi:type="xsd:string">roland</FirstName><Salary xsi:type="xsd:double">0</Salary></NS2:TSampleStruct></NS1:ech oStructResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
The Java client works for simple types, but with classes its generates an error. Does anyone know whats wrong?