You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by jackdawson <ab...@gmail.com> on 2008/09/19 18:53:55 UTC

Problem with Axis2 client and XFire service

Hi,

I created an Axis2 client for an XFire service. But something seems to be
wrong. 
When I run the client this is what I get.

org.apache.axis2.AxisFault: Parameter {urn:login.safe.two.us}TestLoginType
does not exist!
	at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
	at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
	at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
	at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

I debugged the client and found that the error occurs when this statement is
executed in the stub:

        //execute the operation client
        _operationClient.execute(true);

Can anyone let me know is it the client that is weird or the service?


Thanks.
-- 
View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19575959.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problem with Axis2 client and XFire service

Posted by jackdawson <ab...@gmail.com>.
Thanks Martin.

Actually, I'm using Eclipse with Axis2 Codegen plugins. When I created
client using it, this is what it created as the stub:
(I'm pasting only the operation "testLogin" implementation from the stub). 
Please let me know if you want me to post my WSDL.

            /**
             * Auto generated method signature
             * 
             * @see us.two.safe.login.LoginService#testLogin
             * @param testLoginType0
             */                    

             public 
us.two.safe.login.LoginServiceStub.TestLoginTypeResponse testLogin(
                   us.two.safe.login.LoginServiceStub.TestLoginType
testLoginType0) throws java.rmi.RemoteException
                    
              {
              org.apache.axis2.context.MessageContext _messageContext =
null;
              try{
               	org.apache.axis2.client.OperationClient _operationClient = 
				_serviceClient.createClient(_operations[0].getName());
		_operationClient.getOptions().setAction("\"\"");
              
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");

              // create a message context
              _messageContext = new
org.apache.axis2.context.MessageContext();
              

              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env = null;
                                                                
              env =
toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                    testLoginType0,
                                                    optimizeContent(new
javax.xml.namespace.QName("urn:login.safe.two.us",
                                                    "testLogin")));
              
	      //adding SOAP soap_headers
	      _serviceClient.addHeadersToEnvelope(env);

              // set the message context with that soap envelope
              _messageContext.setEnvelope(env);

             // add the message contxt to the operation client
             _operationClient.addMessageContext(_messageContext);

             //execute the operation client
             _operationClient.execute(true);

             org.apache.axis2.context.MessageContext _returnMessageContext =
_operationClient.getMessageContext(
                                          
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             org.apache.axiom.soap.SOAPEnvelope _returnEnv =
_returnMessageContext.getEnvelope();
                
                
             java.lang.Object object =
fromOM(_returnEnv.getBody().getFirstElement() ,
					two.safe.login.LoginServiceStub.TestLoginTypeResponse.class,
                                             
getEnvelopeNamespaces(_returnEnv));

                               
             return
(us.two.safe.login.LoginServiceStub.TestLoginTypeResponse)object;
                                   
         }
	catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName = 							
(java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass =
java.lang.Class.forName(exceptionClassName);
                        java.lang.Exception ex=
                                (java.lang.Exception)
exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName =
(java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass =
java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject =
fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m =
exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                        

                        throw new java.rmi.RemoteException(ex.getMessage(),
ex);
                    }catch(java.lang.ClassCastException e){
                       // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    } catch (java.lang.ClassNotFoundException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }catch (java.lang.NoSuchMethodException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    } catch (java.lang.reflect.InvocationTargetException e)
{
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }  catch (java.lang.IllegalAccessException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }   catch (java.lang.InstantiationException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }
                }else{
                    throw f;
                }
            }else{
                throw f;
            }
            } finally {
               
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
            }
        }


Thanks.
-- 
View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19578313.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problem with Axis2 client and XFire service

Posted by jackdawson <ab...@gmail.com>.
Thanks Martin. You are quick. I really appreciate it.
Please let me know what should go inside
_operationClient.getOptions().setAction("");
Here is the WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="urn:login.safe.two.us"
	xmlns:apachesoap="http://xml.apache.org/xml-soap"
	xmlns:impl="urn:login.safe.two.us"
	xmlns:intf="urn:login.safe.two.us"
	xmlns="http://schemas.xmlsoap.org/wsdl/"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	
	<types>
		<xsd:schema elementFormDefault="qualified"
			targetNamespace="urn:login.safe.two.us"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema">			
			
			<xsd:element name="TestLoginType">
			<xsd:complexType>
				<xsd:sequence>
					<xsd:element name="eid" maxOccurs="1" minOccurs="1" type="xsd:string"/>
					<xsd:element name="key" nillable="true" type="xsd:string"/>
				</xsd:sequence>
			</xsd:complexType>
			</xsd:element>
			
			<xsd:element name="TestLoginTypeResponse">
			<xsd:complexType>
				<xsd:sequence>
					<xsd:element name="failedReason" nillable="true" type="xsd:string"/>
					<xsd:element name="status" type="xsd:boolean"/>
				</xsd:sequence>
			</xsd:complexType>
			</xsd:element>

		</xsd:schema>
	</types>
	
	<message name="testLoginRequest">
		<part name="testLoginRequestAttributes" element="impl:TestLoginType"/>
	</message>
	
	<message name="testLoginResponse">
		<part name="testLoginResponseAttributes"
element="impl:TestLoginTypeResponse"/> 
	</message>

	<portType name="LoginServicePortType">
		<operation name="testLogin">
			<input message="impl:testLoginRequest" name="testLoginRequest"/>
			<output message="impl:testLoginResponse" name="testLoginResponse"/>
		</operation>
	</portType>

	<binding name="LoginServiceSoapBinding" type="impl:LoginServicePortType">
		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="testLogin">
			<soap:operation soapAction=""/>
			<input name="testLoginRequest">
				<soap:body use="literal"/>
			</input>
			<output name="testLoginResponse">
				<soap:body use="literal"/>
			</output>
		</operation>
	</binding>
	
	<service name="LoginService">
		<port binding="impl:LoginServiceSoapBinding" name="LoginService">			
			<soap:address
location="http://JISAUTHDEV:8185/JisAuthentication/services/authorization"/>			
		</port>
	</service>
	
</definitions>



Thanks.





































mgainty wrote:
> 
> 
> the action name you supplied looks problematic
> it should look something like
>         try
>         {
>                org.apache.axis2.client.OperationClient _operationClient =
> _serviceClient.createClient(_operations[0].getName());
>              
> _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks");
>         }
>         catch(org.apache.axis2.AxisFault f)
>         {
>            log.debug("AxisFault has been thrown ..");
>         }
> in any event could you please post your WSDL 
> 
> thanks,
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission. 
> 
> 
>> Date: Mon, 22 Sep 2008 06:28:45 -0700
>> From: abhishek.foi@gmail.com
>> To: axis-user@ws.apache.org
>> Subject: RE: Problem with Axis2 client and XFire service
>> 
>> 
>> Thanks Martin.
>> 
>> Actually, I'm using Eclipse with Axis2 Codegen plugins. When I created
>> client using it, this is what it created as the stub:
>> (I'm pasting only the operation "testLogin" implementation from the
>> stub).
>> Please let me know if you want me to post my WSDL.
>> 
>>             /**
>>              * Auto generated method signature
>>              *
>>              * @see us.two.safe.login.LoginService#testLogin
>>              * @param testLoginType0
>>              */                    
>> 
>>              public 
>> us.two.safe.login.LoginServiceStub.TestLoginTypeResponse testLogin(
>>                    us.two.safe.login.LoginServiceStub.TestLoginType
>> testLoginType0) throws java.rmi.RemoteException
>>                    
>>               {
>>               org.apache.axis2.context.MessageContext _messageContext =
>> null;
>>               try{
>>                 org.apache.axis2.client.OperationClient _operationClient
>> =
>>                                
>> _serviceClient.createClient(_operations[0].getName());
>>                 _operationClient.getOptions().setAction("\"\"");
>>              
>> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
>> 
>> addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
>> 
>>               // create a message context
>>               _messageContext = new
>> org.apache.axis2.context.MessageContext();
>>              
>> 
>>               // create SOAP envelope with that payload
>>               org.apache.axiom.soap.SOAPEnvelope env = null;
>>                                                                
>>               env =
>> toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
>>                                                     testLoginType0,
>>                                                     optimizeContent(new
>> javax.xml.namespace.QName("urn:login.safe.two.us",
>>                                                     "testLogin")));
>>              
>>               //adding SOAP soap_headers
>>               _serviceClient.addHeadersToEnvelope(env);
>> 
>>               // set the message context with that soap envelope
>>               _messageContext.setEnvelope(env);
>> 
>>              // add the message contxt to the operation client
>>              _operationClient.addMessageContext(_messageContext);
>> 
>>              //execute the operation client
>>              _operationClient.execute(true);
>> 
>>              org.apache.axis2.context.MessageContext
>> _returnMessageContext =
>> _operationClient.getMessageContext(
>>                                           
>> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>>              org.apache.axiom.soap.SOAPEnvelope _returnEnv =
>> _returnMessageContext.getEnvelope();
>>                
>>                
>>              java.lang.Object object =
>> fromOM(_returnEnv.getBody().getFirstElement() ,
>>                                        
>> two.safe.login.LoginServiceStub.TestLoginTypeResponse.class,
>>                                              
>> getEnvelopeNamespaces(_returnEnv));
>> 
>>                                
>>              return
>> (us.two.safe.login.LoginServiceStub.TestLoginTypeResponse)object;
>>                                    
>>          }
>>         catch(org.apache.axis2.AxisFault f){
>> 
>>             org.apache.axiom.om.OMElement faultElt = f.getDetail();
>>             if (faultElt!=null){
>>                 if
>> (faultExceptionNameMap.containsKey(faultElt.getQName())){
>>                     //make the fault by reflection
>>                     try{
>>                         java.lang.String exceptionClassName =
>> (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
>>                         java.lang.Class exceptionClass =
>> java.lang.Class.forName(exceptionClassName);
>>                         java.lang.Exception ex=
>>                                 (java.lang.Exception)
>> exceptionClass.newInstance();
>>                         //message class
>>                         java.lang.String messageClassName =
>> (java.lang.String)faultMessageMap.get(faultElt.getQName());
>>                         java.lang.Class messageClass =
>> java.lang.Class.forName(messageClassName);
>>                         java.lang.Object messageObject =
>> fromOM(faultElt,messageClass,null);
>>                         java.lang.reflect.Method m =
>> exceptionClass.getMethod("setFaultMessage",
>>                                    new java.lang.Class[]{messageClass});
>>                         m.invoke(ex,new
>> java.lang.Object[]{messageObject});
>>                        
>> 
>>                         throw new
>> java.rmi.RemoteException(ex.getMessage(),
>> ex);
>>                     }catch(java.lang.ClassCastException e){
>>                        // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     } catch (java.lang.ClassNotFoundException e) {
>>                         // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     }catch (java.lang.NoSuchMethodException e) {
>>                         // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     } catch (java.lang.reflect.InvocationTargetException
>> e)
>> {
>>                         // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     }  catch (java.lang.IllegalAccessException e) {
>>                         // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     }   catch (java.lang.InstantiationException e) {
>>                         // we cannot intantiate the class - throw the
>> original Axis fault
>>                         throw f;
>>                     }
>>                 }else{
>>                     throw f;
>>                 }
>>             }else{
>>                 throw f;
>>             }
>>             } finally {
>>                
>> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
>>             }
>>         }
>> 
>> 
>> Thanks.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> mgainty wrote:
>> > 
>> > 
>> > the answer is neither
>> > 
>> > you'll need to construct a messageContext 
>> > fill it with the supplied OMElement parameter
>> > create a client using the supplied operation parameter
>> > add the messageContext to your just created client
>> > then execute..
>> > e.g.
>> > 
>> >     /**
>> >      * Directly invoke a named operation with a Robust In-Only MEP.
>> This
>> > method
>> >      * just sends your supplied XML and possibly receives a fault. For
>> > more
>> >      * control, you can instead create a client for the operation and
>> use
>> > that
>> >      * client to execute the send.
>> >      *
>> >      * @param operation name of operation to be invoked
>> > (non-<code>null</code>)
>> >      * @param elem      XML to send
>> >      * @throws AxisFault if something goes wrong while sending it or if
>> a
>> > fault is
>> >      *                   received in response (per the Robust In-Only
>> > MEP).
>> >      * @see #createClient(QName)
>> >      */
>> >     public void sendRobust(QName operation, OMElement elem) throws
>> > AxisFault {
>> >         MessageContext mc = new MessageContext();
>> >         fillSOAPEnvelope(mc, elem);
>> >         OperationClient mepClient = createClient(operation);
>> >         mepClient.addMessageContext(mc);
>> >         mepClient.execute(true);
>> >     }
>> > 
>> > If you are unable to execute the client call we will need to see your
>> wsdl
>> > to assist you further
>> > 
>> > Martin 
>> > ______________________________________________ 
>> > Disclaimer and confidentiality note 
>> > Everything in this e-mail and any attachments relates to the official
>> > business of Sender. This transmission is of a confidential nature and
>> > Sender does not endorse distribution to any party other than intended
>> > recipient. Sender does not necessarily endorse content contained within
>> > this transmission. 
>> > 
>> > 
>> >> Date: Fri, 19 Sep 2008 09:53:55 -0700
>> >> From: abhishek.foi@gmail.com
>> >> To: axis-user@ws.apache.org
>> >> Subject: Problem with Axis2 client and XFire service
>> >> 
>> >> 
>> >> Hi,
>> >> 
>> >> I created an Axis2 client for an XFire service. But something seems to
>> be
>> >> wrong. 
>> >> When I run the client this is what I get.
>> >> 
>> >> org.apache.axis2.AxisFault: Parameter
>> >> {urn:login.safe.two.us}TestLoginType
>> >> does not exist!
>> >> 	at
>> >>
>> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
>> >> 	at
>> >>
>> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
>> >> 	at
>> >>
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>> >> 	at
>> >>
>> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>> >> 	at
>> >>
>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>> >> 
>> >> I debugged the client and found that the error occurs when this
>> statement
>> >> is
>> >> executed in the stub:
>> >> 
>> >>         //execute the operation client
>> >>         _operationClient.execute(true);
>> >> 
>> >> Can anyone let me know is it the client that is weird or the service?
>> >> 
>> >> 
>> >> Thanks.
>> >> -- 
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19575959.html
>> >> Sent from the Axis - User mailing list archive at Nabble.com.
>> >> 
>> >> 
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail: axis-user-help@ws.apache.org
>> >> 
>> > 
>> > _________________________________________________________________
>> > Get more out of the Web. Learn 10 hidden secrets of Windows Live.
>> >
>> http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19607953.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> 
> 
> _________________________________________________________________
> Get more out of the Web. Learn 10 hidden secrets of Windows Live.
> http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19610446.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problem with Axis2 client and XFire service

Posted by Martin Gainty <mg...@hotmail.com>.
the action name you supplied looks problematic
it should look something like
        try
        {
               org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
              _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks");
        }
        catch(org.apache.axis2.AxisFault f)
        {
           log.debug("AxisFault has been thrown ..");
        }
in any event could you please post your WSDL 

thanks,
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Mon, 22 Sep 2008 06:28:45 -0700
> From: abhishek.foi@gmail.com
> To: axis-user@ws.apache.org
> Subject: RE: Problem with Axis2 client and XFire service
> 
> 
> Thanks Martin.
> 
> Actually, I'm using Eclipse with Axis2 Codegen plugins. When I created
> client using it, this is what it created as the stub:
> (I'm pasting only the operation "testLogin" implementation from the stub).
> Please let me know if you want me to post my WSDL.
> 
>             /**
>              * Auto generated method signature
>              *
>              * @see us.two.safe.login.LoginService#testLogin
>              * @param testLoginType0
>              */                    
> 
>              public 
> us.two.safe.login.LoginServiceStub.TestLoginTypeResponse testLogin(
>                    us.two.safe.login.LoginServiceStub.TestLoginType
> testLoginType0) throws java.rmi.RemoteException
>                    
>               {
>               org.apache.axis2.context.MessageContext _messageContext =
> null;
>               try{
>                 org.apache.axis2.client.OperationClient _operationClient =
>                                
> _serviceClient.createClient(_operations[0].getName());
>                 _operationClient.getOptions().setAction("\"\"");
>              
> _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
> 
> addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");
> 
>               // create a message context
>               _messageContext = new
> org.apache.axis2.context.MessageContext();
>              
> 
>               // create SOAP envelope with that payload
>               org.apache.axiom.soap.SOAPEnvelope env = null;
>                                                                
>               env =
> toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
>                                                     testLoginType0,
>                                                     optimizeContent(new
> javax.xml.namespace.QName("urn:login.safe.two.us",
>                                                     "testLogin")));
>              
>               //adding SOAP soap_headers
>               _serviceClient.addHeadersToEnvelope(env);
> 
>               // set the message context with that soap envelope
>               _messageContext.setEnvelope(env);
> 
>              // add the message contxt to the operation client
>              _operationClient.addMessageContext(_messageContext);
> 
>              //execute the operation client
>              _operationClient.execute(true);
> 
>              org.apache.axis2.context.MessageContext _returnMessageContext =
> _operationClient.getMessageContext(
>                                           
> org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>              org.apache.axiom.soap.SOAPEnvelope _returnEnv =
> _returnMessageContext.getEnvelope();
>                
>                
>              java.lang.Object object =
> fromOM(_returnEnv.getBody().getFirstElement() ,
>                                        
> two.safe.login.LoginServiceStub.TestLoginTypeResponse.class,
>                                              
> getEnvelopeNamespaces(_returnEnv));
> 
>                                
>              return
> (us.two.safe.login.LoginServiceStub.TestLoginTypeResponse)object;
>                                    
>          }
>         catch(org.apache.axis2.AxisFault f){
> 
>             org.apache.axiom.om.OMElement faultElt = f.getDetail();
>             if (faultElt!=null){
>                 if (faultExceptionNameMap.containsKey(faultElt.getQName())){
>                     //make the fault by reflection
>                     try{
>                         java.lang.String exceptionClassName =
> (java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
>                         java.lang.Class exceptionClass =
> java.lang.Class.forName(exceptionClassName);
>                         java.lang.Exception ex=
>                                 (java.lang.Exception)
> exceptionClass.newInstance();
>                         //message class
>                         java.lang.String messageClassName =
> (java.lang.String)faultMessageMap.get(faultElt.getQName());
>                         java.lang.Class messageClass =
> java.lang.Class.forName(messageClassName);
>                         java.lang.Object messageObject =
> fromOM(faultElt,messageClass,null);
>                         java.lang.reflect.Method m =
> exceptionClass.getMethod("setFaultMessage",
>                                    new java.lang.Class[]{messageClass});
>                         m.invoke(ex,new java.lang.Object[]{messageObject});
>                        
> 
>                         throw new java.rmi.RemoteException(ex.getMessage(),
> ex);
>                     }catch(java.lang.ClassCastException e){
>                        // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     } catch (java.lang.ClassNotFoundException e) {
>                         // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     }catch (java.lang.NoSuchMethodException e) {
>                         // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     } catch (java.lang.reflect.InvocationTargetException e)
> {
>                         // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     }  catch (java.lang.IllegalAccessException e) {
>                         // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     }   catch (java.lang.InstantiationException e) {
>                         // we cannot intantiate the class - throw the
> original Axis fault
>                         throw f;
>                     }
>                 }else{
>                     throw f;
>                 }
>             }else{
>                 throw f;
>             }
>             } finally {
>                
> _messageContext.getTransportOut().getSender().cleanup(_messageContext);
>             }
>         }
> 
> 
> Thanks.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> mgainty wrote:
> > 
> > 
> > the answer is neither
> > 
> > you'll need to construct a messageContext 
> > fill it with the supplied OMElement parameter
> > create a client using the supplied operation parameter
> > add the messageContext to your just created client
> > then execute..
> > e.g.
> > 
> >     /**
> >      * Directly invoke a named operation with a Robust In-Only MEP. This
> > method
> >      * just sends your supplied XML and possibly receives a fault. For
> > more
> >      * control, you can instead create a client for the operation and use
> > that
> >      * client to execute the send.
> >      *
> >      * @param operation name of operation to be invoked
> > (non-<code>null</code>)
> >      * @param elem      XML to send
> >      * @throws AxisFault if something goes wrong while sending it or if a
> > fault is
> >      *                   received in response (per the Robust In-Only
> > MEP).
> >      * @see #createClient(QName)
> >      */
> >     public void sendRobust(QName operation, OMElement elem) throws
> > AxisFault {
> >         MessageContext mc = new MessageContext();
> >         fillSOAPEnvelope(mc, elem);
> >         OperationClient mepClient = createClient(operation);
> >         mepClient.addMessageContext(mc);
> >         mepClient.execute(true);
> >     }
> > 
> > If you are unable to execute the client call we will need to see your wsdl
> > to assist you further
> > 
> > Martin 
> > ______________________________________________ 
> > Disclaimer and confidentiality note 
> > Everything in this e-mail and any attachments relates to the official
> > business of Sender. This transmission is of a confidential nature and
> > Sender does not endorse distribution to any party other than intended
> > recipient. Sender does not necessarily endorse content contained within
> > this transmission. 
> > 
> > 
> >> Date: Fri, 19 Sep 2008 09:53:55 -0700
> >> From: abhishek.foi@gmail.com
> >> To: axis-user@ws.apache.org
> >> Subject: Problem with Axis2 client and XFire service
> >> 
> >> 
> >> Hi,
> >> 
> >> I created an Axis2 client for an XFire service. But something seems to be
> >> wrong. 
> >> When I run the client this is what I get.
> >> 
> >> org.apache.axis2.AxisFault: Parameter
> >> {urn:login.safe.two.us}TestLoginType
> >> does not exist!
> >> 	at
> >> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
> >> 	at
> >> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
> >> 	at
> >> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
> >> 	at
> >> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> >> 	at
> >> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> >> 
> >> I debugged the client and found that the error occurs when this statement
> >> is
> >> executed in the stub:
> >> 
> >>         //execute the operation client
> >>         _operationClient.execute(true);
> >> 
> >> Can anyone let me know is it the client that is weird or the service?
> >> 
> >> 
> >> Thanks.
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19575959.html
> >> Sent from the Axis - User mailing list archive at Nabble.com.
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >> 
> > 
> > _________________________________________________________________
> > Get more out of the Web. Learn 10 hidden secrets of Windows Live.
> > http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19607953.html
> Sent from the Axis - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008

RE: Problem with Axis2 client and XFire service

Posted by jackdawson <ab...@gmail.com>.
Thanks Martin.

Actually, I'm using Eclipse with Axis2 Codegen plugins. When I created
client using it, this is what it created as the stub:
(I'm pasting only the operation "testLogin" implementation from the stub).
Please let me know if you want me to post my WSDL.

            /**
             * Auto generated method signature
             *
             * @see us.two.safe.login.LoginService#testLogin
             * @param testLoginType0
             */                    

             public 
us.two.safe.login.LoginServiceStub.TestLoginTypeResponse testLogin(
                   us.two.safe.login.LoginServiceStub.TestLoginType
testLoginType0) throws java.rmi.RemoteException
                   
              {
              org.apache.axis2.context.MessageContext _messageContext =
null;
              try{
                org.apache.axis2.client.OperationClient _operationClient =
                               
_serviceClient.createClient(_operations[0].getName());
                _operationClient.getOptions().setAction("\"\"");
             
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");

              // create a message context
              _messageContext = new
org.apache.axis2.context.MessageContext();
             

              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env = null;
                                                               
              env =
toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                    testLoginType0,
                                                    optimizeContent(new
javax.xml.namespace.QName("urn:login.safe.two.us",
                                                    "testLogin")));
             
              //adding SOAP soap_headers
              _serviceClient.addHeadersToEnvelope(env);

              // set the message context with that soap envelope
              _messageContext.setEnvelope(env);

             // add the message contxt to the operation client
             _operationClient.addMessageContext(_messageContext);

             //execute the operation client
             _operationClient.execute(true);

             org.apache.axis2.context.MessageContext _returnMessageContext =
_operationClient.getMessageContext(
                                          
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             org.apache.axiom.soap.SOAPEnvelope _returnEnv =
_returnMessageContext.getEnvelope();
               
               
             java.lang.Object object =
fromOM(_returnEnv.getBody().getFirstElement() ,
                                       
two.safe.login.LoginServiceStub.TestLoginTypeResponse.class,
                                             
getEnvelopeNamespaces(_returnEnv));

                               
             return
(us.two.safe.login.LoginServiceStub.TestLoginTypeResponse)object;
                                   
         }
        catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName =
(java.lang.String)faultExceptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass =
java.lang.Class.forName(exceptionClassName);
                        java.lang.Exception ex=
                                (java.lang.Exception)
exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName =
(java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass =
java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject =
fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m =
exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                       

                        throw new java.rmi.RemoteException(ex.getMessage(),
ex);
                    }catch(java.lang.ClassCastException e){
                       // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    } catch (java.lang.ClassNotFoundException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }catch (java.lang.NoSuchMethodException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    } catch (java.lang.reflect.InvocationTargetException e)
{
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }  catch (java.lang.IllegalAccessException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }   catch (java.lang.InstantiationException e) {
                        // we cannot intantiate the class - throw the
original Axis fault
                        throw f;
                    }
                }else{
                    throw f;
                }
            }else{
                throw f;
            }
            } finally {
               
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
            }
        }


Thanks.












mgainty wrote:
> 
> 
> the answer is neither
> 
> you'll need to construct a messageContext 
> fill it with the supplied OMElement parameter
> create a client using the supplied operation parameter
> add the messageContext to your just created client
> then execute..
> e.g.
> 
>     /**
>      * Directly invoke a named operation with a Robust In-Only MEP. This
> method
>      * just sends your supplied XML and possibly receives a fault. For
> more
>      * control, you can instead create a client for the operation and use
> that
>      * client to execute the send.
>      *
>      * @param operation name of operation to be invoked
> (non-<code>null</code>)
>      * @param elem      XML to send
>      * @throws AxisFault if something goes wrong while sending it or if a
> fault is
>      *                   received in response (per the Robust In-Only
> MEP).
>      * @see #createClient(QName)
>      */
>     public void sendRobust(QName operation, OMElement elem) throws
> AxisFault {
>         MessageContext mc = new MessageContext();
>         fillSOAPEnvelope(mc, elem);
>         OperationClient mepClient = createClient(operation);
>         mepClient.addMessageContext(mc);
>         mepClient.execute(true);
>     }
> 
> If you are unable to execute the client call we will need to see your wsdl
> to assist you further
> 
> Martin 
> ______________________________________________ 
> Disclaimer and confidentiality note 
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission. 
> 
> 
>> Date: Fri, 19 Sep 2008 09:53:55 -0700
>> From: abhishek.foi@gmail.com
>> To: axis-user@ws.apache.org
>> Subject: Problem with Axis2 client and XFire service
>> 
>> 
>> Hi,
>> 
>> I created an Axis2 client for an XFire service. But something seems to be
>> wrong. 
>> When I run the client this is what I get.
>> 
>> org.apache.axis2.AxisFault: Parameter
>> {urn:login.safe.two.us}TestLoginType
>> does not exist!
>> 	at
>> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
>> 	at
>> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
>> 	at
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>> 	at
>> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>> 	at
>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>> 
>> I debugged the client and found that the error occurs when this statement
>> is
>> executed in the stub:
>> 
>>         //execute the operation client
>>         _operationClient.execute(true);
>> 
>> Can anyone let me know is it the client that is weird or the service?
>> 
>> 
>> Thanks.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19575959.html
>> Sent from the Axis - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> 
> 
> _________________________________________________________________
> Get more out of the Web. Learn 10 hidden secrets of Windows Live.
> http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19607953.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problem with Axis2 client and XFire service

Posted by Martin Gainty <mg...@hotmail.com>.
the answer is neither

you'll need to construct a messageContext 
fill it with the supplied OMElement parameter
create a client using the supplied operation parameter
add the messageContext to your just created client
then execute..
e.g.

    /**
     * Directly invoke a named operation with a Robust In-Only MEP. This method
     * just sends your supplied XML and possibly receives a fault. For more
     * control, you can instead create a client for the operation and use that
     * client to execute the send.
     *
     * @param operation name of operation to be invoked (non-<code>null</code>)
     * @param elem      XML to send
     * @throws AxisFault if something goes wrong while sending it or if a fault is
     *                   received in response (per the Robust In-Only MEP).
     * @see #createClient(QName)
     */
    public void sendRobust(QName operation, OMElement elem) throws AxisFault {
        MessageContext mc = new MessageContext();
        fillSOAPEnvelope(mc, elem);
        OperationClient mepClient = createClient(operation);
        mepClient.addMessageContext(mc);
        mepClient.execute(true);
    }

If you are unable to execute the client call we will need to see your wsdl to assist you further

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Fri, 19 Sep 2008 09:53:55 -0700
> From: abhishek.foi@gmail.com
> To: axis-user@ws.apache.org
> Subject: Problem with Axis2 client and XFire service
> 
> 
> Hi,
> 
> I created an Axis2 client for an XFire service. But something seems to be
> wrong. 
> When I run the client this is what I get.
> 
> org.apache.axis2.AxisFault: Parameter {urn:login.safe.two.us}TestLoginType
> does not exist!
> 	at
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
> 	at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> 
> I debugged the client and found that the error occurs when this statement is
> executed in the stub:
> 
>         //execute the operation client
>         _operationClient.execute(true);
> 
> Can anyone let me know is it the client that is weird or the service?
> 
> 
> Thanks.
> -- 
> View this message in context: http://www.nabble.com/Problem-with-Axis2-client-and-XFire-service-tp19575959p19575959.html
> Sent from the Axis - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008