You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Sampige, Srinivas" <Sr...@PSS.Boeing.com> on 2001/06/07 23:46:51 UTC

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/CuisAuthentication.wsdl
  URN =http://tempuri.org/message/
Success!!!
Result= false Name -> Result
--------------------------------

thanks
Srinivas





---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org