I have done the mappings in the part of the code that i did not post .Here is what iam
doing before calling the service :
-------------------------
String urn = "http://tempuri.org/message/";
// define deserializers for the return things (without xsi:type)
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "Result"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "sApplicationKey"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("",
"sValidationMethod"), null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "sDomain"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "sUserName"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "sPassword"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "lBemsId"),
null,null, sd);
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName("", "sDescription"),
null,null, sd);
// create the transport and set parameters
-----------------------------------------------------
What iam not able to figure out is what code do i write to read the other parameters
?I tried casting the return value of response.getValue() to a String array only to get
a class cast exception.I was thinking that the result is coming back as an array of
which one of the elements contains the value of sDescription.
-------------------------------------------
if( !response.generatedFault() )
{
Parameter result = response.getReturnValue(); //response
was OK
System.out.println( "Result= "+ result.getValue()+" Name
-> "+result.getName());
return true;
-----------------------------------------------------
thanks
Srinivas
-----Original Message-----
From: Vishweshwar, Ghanakota [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 3:09 PM
To: '[EMAIL PROTECTED]'
Subject: FW: reading return parameters
Hi Srinivas,
you have to map the types. look at the following snippet for how to do it.
smr = new SOAPMappingRegistry();
TypeMapper beanSer = new TypeMapper();
// Map the types.
smr.mapTypes("http://schemas.xmlsoap.org/soap/encoding/",
new QName("", "Result"),
TypeMapper.class, beanSer, beanSer);
call.setSOAPMappingRegistry(smr);
here I have mapped my custom class "TypeMapper" with "Result". you have to
do similar thing for other tags you have. you can use the simplest
StringSerializer, if all that you need is just the string.
thanks,
vishu
-----Original Message-----
From: Sampige, Srinivas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 2:47 PM
To: '[EMAIL PROTECTED]'
Subject: reading return parameters
The respponse iam getting from the server is :-
----------------------------------------------------------------------------
-------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <SOAPSDK1:AuthenticateUserResponse
xmlns:SOAPSDK1="http://tempuri.org/message/">
<Result>false</Result>
<sApplicationKey>TestApplicationKey</sApplicationKey>
<sValidationMethod>NT</sValidationMethod>
<sDomain>NTRMRTN1</sDomain>
<sUserName>aaa1234</sUserName>
<sPassword>PASSWORD</sPassword>
<lBemsId>0</lBemsId>
<sDescription>Logon failure: unknown user name or bad
password.</sDescription>
</SOAPSDK1:AuthenticateUserResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
----------------------------------------------------------------------------
-------------
In my Java client Iam able to read only the value enclosed within
"Result" i.e <Result>false</Result> .How do i read the other values like
sDescription which gives me the error message ? .Here is the code :-
--------------
Call call = new Call(); // prepare the service invocation
call.setSOAPTransport(st);
call.setSOAPMappingRegistry (smr);
call.setTargetObjectURI( urn );
call.setMethodName("AuthenticateUser");
call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );
Vector params = new Vector();
params.addElement(new
Parameter("sApplicationKey",String.class,"TestApplicationKey",null));
params.addElement(new
Parameter("sValidationMethod",String.class,"NT",null));
params.addElement(new
Parameter("sDomain",String.class,"NTRMRTN1",null));
params.addElement(new
Parameter("sUserName",String.class,"aaa1234",null));
params.addElement(new
Parameter("sPassword",String.class,"PASSWORD",null));
params.addElement(new Parameter("lBemsId",int.class,new
Integer("0"),null));
params.addElement(new
Parameter("sDescription",String.class,"PASSWORD",null));
call.setParams(params);
try
{
System.out.println( "invoke service\n" + " URL= " + url+
"\n URN ="+urn );
Response response = call.invoke( url,
"http://tempuri.org/action/CuisAuthenticationSoap.AuthenticateUser" );
System.out.println("Success!!!");
if( !response.generatedFault() )
{
Parameter result = response.getReturnValue(); //response
was OK
System.out.println( "Result= "+ result.getValue()+" Name
-> "+result.getName());
return true;
}
else
{
Fault f = response.getFault(); // an error occurred
System.err.println( "Fault=
"+f.getFaultCode()+","+f.getFaultString() );
return false;
}
}catch( SOAPException e ) // call could not be sent properly
{
System.err.println( "SOAPException= " + e.getFaultCode() +
", " +e.getMessage() );
return false;
}
}catch(Exception e)
{
e.printStackTrace();
return false;
}
}
-------------------------------
Output that iam getting now is :-
---------------------------------
contacting the Service ....
invoke service
URL=
http://cuis-dev-02.nw.nos.boeing.com:8080/AuthenticationSoap/CuisAuthenticat
ion.wsdl
URN =http://tempuri.org/message/
Success!!!
Result= false Name -> Result
--------------------------------
thanks
Srinivas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]