You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Giovanni Ruggiero <ru...@cefriel.it> on 2001/04/18 12:56:32 UTC
Extraction of element values form a compound response
Hi
Can anybody suggest how can I extract the value of:
<Interroga>False</Interroga>
<Prenota>False</Prenota>
<Cancella>False</Cancella>
<Rinvia>False</Rinvia>
inside the <result>...</result> tags
the complete response I get is:
-------------------------------------
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soap:Body>
<LogInResponse xmlns="http://tempuri.org/">
<result>
<Interroga>False</Interroga>
<Prenota>False</Prenota>
<Cancella>False</Cancella>
<Rinvia>False</Rinvia>
</result>
</LogInResponse>
</soap:Body>
</soap:Envelope>
------------------------------------------------------
and the client code I'm using to invoce the server is:
-------------------------------------------------------
public class Login
{
public static void main(String[] args) throws Exception
{
URL url=new
URL("http://localhost:8060/Autenticazione/Autenticazione.asmx"); // Address
of SOAP router
SOAPMappingRegistry smr = new SOAPMappingRegistry();
ParameterSerializer ps = new ParameterSerializer();
StringDeserializer sd = new StringDeserializer();
smr.mapTypes (null, RPCConstants.Q_ELEM_PARAMETER, Parameter.class,
null, ps);
smr.mapTypes (null, new QName("http://tempuri.org/", "result"), null,
null, sd);
// create the transport and set parameters
SOAPHTTPConnection st = new SOAPHTTPConnection();
String username = "Giovanni";
String password = "Ruggiero";
Vector params = new Vector();
// Build the call
Call call=new Call();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("http://tempuri.org/");
call.setMethodName("LogIn");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
params.addElement(new Parameter("username", String.class, username,
null));
params.addElement(new Parameter("password", String.class, password,
null));
call.setParams(params);
// Invoke the call to the SOAP server
Response resp = call.invoke(url,"http://tempuri.org/LogIn");
// Print the returned string
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println(value);
}
}
---------------------------------------------------------
I'm sure there's something missing
could anyone point it out
Thanks a lot
Giovanni
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org