Before pointing you in a direction using Apache SOAP, let me point out that if you are
new to Apache SOAP, you should use Apache Axis instead. Axis supports more specs than
Apache SOAP and continues to evolve. It supports WSDL and has a tool that can process
the WSDL and create any necessary client proxy classes. For a generic complexType as
shown in the WSDL, it will probably let you create a DOM fragment to pass to the
service.
Now, if you insist on using Apache SOAP...
The service is expecting a complexType, which corresponds to a bean in Java. Instead
of the string, you need to use classes like
class _Application_Identification {
public string AppId;
}
class _Data {
public double Amount;
}
Then you register these types to use the BeanSerializer (fill in the call params)
smr.addType(... _Application_Identification ...);
smr.addType(... _Data ...);
Then you add instances of these to the parameters Vector.
Scott Nichol
Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message -----
From: "nilesh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 29, 2004 7:07 AM
Subject: Server was unable to read request
Hi all,
i am getting following SOAP Fault error...
Fault Code = soap:Client
Fault String = Server was unable to read request. --> There is an error in XML
document (6, 3). --> The element 'urn:schemas-nil:dal:webservices:messag
eschemas/authorisation_input:Input_Message' cannot contain text. Expected
'urn:schemas-nil:dal:webservices:messageschemas/operational:Operational
'. An error occurred at , (1, 106).
Thsi is my code of java soap client..
String TEST_XML = "<Input_Message
xmlns=\"urn:schemas-nil:dal:webservices:messageschemas\"><Operational><Application_Identification><AppId>A2G</AppId></Application_Identification></Operational><Data><Amount>123567.12</Amount></Data></Input_Message>";
URL url = new URL ("http://192.168.1.7/PayAuth2/Authorisation_Stub.asmx");
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName ("","AuthoriseResult"),null, null,
sd);
Call call = new Call ();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry (smr);
call.setTargetObjectURI ("urn:schemas-nil:dal:webservices/authorisation");
call.setMethodName("Authorise");
call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);
call.getSOAPContext().setDocLitSerialization(true);
Vector params = new Vector();
params.addElement(new Parameter("request",java.lang.String.class, TEST_XML,
Constants.NS_URI_SOAP_ENC));
call.setParams(params);
Response resp = null;
try {
resp = call.invoke (url, "urn:schemas-nil:dal:webservices/authorisation/Authorise");
}
catch (SOAPException e) {
System.err.println("Caught SOAPException (" + e.getFaultCode () + "): " + e.getMessage
());
return;
}
my WSDL file looks like this....
- <s:element name="AuthorisePayment">
- <s:complexType>
- <s:sequence>
- <s:element minOccurs="0" maxOccurs="1" name="request">
- <s:complexType>
- <s:sequence>
<s:any
namespace="urn:schemas-nil:dal:webservices:messageschemas/authorisation_input" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
is becuase i am sendig java.lang.String.class but its expecting <s:complexType>. can
tell me the solution for this...