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 Christian Doyle <ch...@gmail.com> on 2007/05/16 23:09:50 UTC

Call other web services

Is it possible to make calls to other Axis 2 services from within an 
Axis 2 service using the RPCServiceClient?  When I try this I receive a 
vague AxisFault:

rg.apache.axis2.AxisFault: outboundNoAction
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
    at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
    at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
    at 
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
    at 
com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
    at 
com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
    at 
com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)

thanks!
-Christian

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


Re: Call other web services

Posted by Christian Doyle <ch...@gmail.com>.
The goal here is when a call is made to the service to add an iEngine it 
queries that iEngine (which is also a service) to get the remote 
system's date.  This isn't particularly pratical, but it does make for a 
pretty good test case as getDate is probably the most simplistic method 
which the service exposes.  I feel like there is some sort of addressing 
problem occurring but I am not knowledgeable enough to know exactly 
what.  Also the service.xml and wsdl file were generated by the eclipse 
plugin and I did not modify them at all.

Relevant pieces of code:
 From IEngine.java (the web service):
/**
     * @param ip
     *            address of the iengine to begin polling
     * @throws Exception
     * @throws AxisFault
     */
    private synchronized void addIEngineHop(String ip, String nextHop) {

        if (!iEngines.containsKey(ip)) {

            // get the iengine that was just added's known devices and 
iengines
            // in order to build a tree structure
            IEngineRPCConnection conn;

            try {
                conn = new IEngineRPCConnection(ip);
                conn.open();

                final SortedSet<String> devices = conn.getDevices();
                final SortedSet<String> iEngines = conn.getIEngines();

                // add all of the deivces and set up their
                // routing table appropriately
                for (String device : devices) {
                    addDevice(device, ip);
                }

                for (String iEngine : iEngines) {
                    IEngine.iEngines.put(iEngine, ip);
                    insertIEngine(iEngine, ip);
                }

                IEngine.iEngines.put(ip, nextHop);
                insertIEngine(ip, nextHop);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

from IEngineRPCConnection (the service client):
public static final String XSD = 
"http://iengine.rfid.odintechnologies.com/xsd";
public static final String URL = "/axis2/services/IEngine";

    public IEngineRPCConnection(String ip) throws AxisFault {
        this.ip = ip;
        client = new RPCServiceClient();
    }

/**
     * opens the connections
     *
     * @throws AxisFault
     */
    public void open() throws AxisFault {
        // set up client options
        final Options options = client.getOptions();
        final EndpointReference er = new EndpointReference("http://" + ip
                + ":8080" + URL);
        options.setTo(er);
        final TransportOutDescription tod = new TransportOutDescription(
                Constants.TRANSPORT_HTTP);
        tod.setSender(new CommonsHTTPTransportSender());
        options.setTransportOut(tod);

    }

public Date getDate() throws AxisFault {

         // set up a call to the service
         final QName opName = new QName(XSD, "getDate");
         final Object[] opArgs = new Object[] {};
         final Class[] returnTypes = new Class[] { Date.class };
       
         // call the service
         final Object[] response = client.invokeBlocking(opName, opArgs,
         returnTypes);
         final Date date = (Date) response[0];
       
         return date;
    }

Deepal Jayasinghe wrote:
> Hi Christian ,
> Yes you can do that  and I have done that too. Sometimes you might have
> done smt wrong , so please send me the src code then I can try and see.
>
> Thanks
> Deepal
>   
>> Is it possible to make calls to other Axis 2 services from within an
>> Axis 2 service using the RPCServiceClient?  When I try this I receive
>> a vague AxisFault:
>>
>> rg.apache.axis2.AxisFault: outboundNoAction
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
>>
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
>>
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
>>
>>    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
>>    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
>>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
>>    at
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
>>
>>    at
>> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
>>
>>    at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
>>    at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
>>    at
>> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
>>
>>    at
>> com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
>>
>>    at
>> com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
>>    at
>> com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)
>>
>> thanks!
>> -Christian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>
>>     
>
>   

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


Re: Call other web services

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Christian ,
Yes you can do that  and I have done that too. Sometimes you might have
done smt wrong , so please send me the src code then I can try and see.

Thanks
Deepal
> Is it possible to make calls to other Axis 2 services from within an
> Axis 2 service using the RPCServiceClient?  When I try this I receive
> a vague AxisFault:
>
> rg.apache.axis2.AxisFault: outboundNoAction
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
>
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
>
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
>
>    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
>    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
>    at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
>
>    at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
>
>    at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
>    at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
>    at
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
>
>    at
> com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
>
>    at
> com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
>    at
> com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)
>
> thanks!
> -Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



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


RE: Can't get the right kind of header

Posted by Furash Gary <fu...@mcao.maricopa.gov>.
Duh!  Argh!  I hate it when I mess something up that's this obvious.  Of
course the headers look different.  Axis is doing just what I was
telling it :-) 

-----Original Message-----
From: Samisa Abeysinghe [mailto:samisa@wso2.com] 
Sent: Wednesday, May 16, 2007 8:29 PM
To: axis-user@ws.apache.org
Subject: Re: Can't get the right kind of header

Samisa Abeysinghe wrote:
> Furash Gary wrote:
>> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but 
>> I'm just trying to get a feel for this first :-)
>>
>> I'm calling a .NET service from Java.  The header I'm generating in 
>> AXIS doesn't look like the header the .NET service wants, so it's 
>> failing with "Unable to handle request without a valid action
parameter".
>>
>> The .NET service wants this in the HTTP header:
>>
>> POST /objacctwebservices/Login.asmx HTTP/1.1
>> Host: mcaosappstest
>> Content-Type: text/xml; charset=utf-8
>> Content-Length: length
>> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>>
>> Instead, my code does something like this:
>>
>> Content-Type: application/soap+xml; charset=utf-8; 
>> action="http://xml.objacct.com/GetLoginKey"
>>
>> And doesn't have a "SOAPAction: " parameter.
>>   
> You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.
See
http://spteam-lists.blogspot.com/2007/05/re-creating-axis2-soap-header.h
tml
on how to set SOAP version with options.
>
> Samisa...
>


--
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web
Services Developers' Portal)


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


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


Re: Can't get the right kind of header

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Samisa Abeysinghe wrote:
> Furash Gary wrote:
>> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
>> just trying to get a feel for this first :-)
>>
>> I'm calling a .NET service from Java.  The header I'm generating in AXIS
>> doesn't look like the header the .NET service wants, so it's failing
>> with "Unable to handle request without a valid action parameter".
>>
>> The .NET service wants this in the HTTP header:
>>
>> POST /objacctwebservices/Login.asmx HTTP/1.1
>> Host: mcaosappstest
>> Content-Type: text/xml; charset=utf-8
>> Content-Length: length
>> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>>
>> Instead, my code does something like this:
>>
>> Content-Type: application/soap+xml; charset=utf-8;
>> action="http://xml.objacct.com/GetLoginKey"
>>
>> And doesn't have a "SOAPAction: " parameter.
>>   
> You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.
See 
http://spteam-lists.blogspot.com/2007/05/re-creating-axis2-soap-header.html 
on how to set SOAP version with options.
>
> Samisa...
>


-- 
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web Services Developers' Portal)


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


Re: Can't get the right kind of header

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Furash Gary wrote:
> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
> just trying to get a feel for this first :-)
>
> I'm calling a .NET service from Java.  The header I'm generating in AXIS
> doesn't look like the header the .NET service wants, so it's failing
> with "Unable to handle request without a valid action parameter".
>
> The .NET service wants this in the HTTP header:
>
> POST /objacctwebservices/Login.asmx HTTP/1.1
> Host: mcaosappstest
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>
> Instead, my code does something like this:
>
> Content-Type: application/soap+xml; charset=utf-8;
> action="http://xml.objacct.com/GetLoginKey"
>
> And doesn't have a "SOAPAction: " parameter.
>   
You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.

Samisa...

-- 
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web Services Developers' Portal)


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


Can't get the right kind of header

Posted by Furash Gary <fu...@mcao.maricopa.gov>.
Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
just trying to get a feel for this first :-)

I'm calling a .NET service from Java.  The header I'm generating in AXIS
doesn't look like the header the .NET service wants, so it's failing
with "Unable to handle request without a valid action parameter".

The .NET service wants this in the HTTP header:

POST /objacctwebservices/Login.asmx HTTP/1.1
Host: mcaosappstest
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://xml.objacct.com/GetLoginKey"

Instead, my code does something like this:

Content-Type: application/soap+xml; charset=utf-8;
action="http://xml.objacct.com/GetLoginKey"

And doesn't have a "SOAPAction: " parameter.

Here's my nifty code:

	ServiceClient client = new ServiceClient();
		Options options = new Options();
		options.setTo(new EndpointReference(uri));
		options.setAction("http://xml.objacct.com/GetLoginKey");
		client.setOptions(options);
		MessageContext msgctx = new MessageContext();
	
msgctx.setEnvelope(LoginKeyMsg.createLoginKeyMessage("MCAO", "admin",
"abc123"));
		OperationClient opClient =
client.createClient(ServiceClient.ANON_OUT_IN_OP);
		opClient.addMessageContext(msgctx);
		opClient.execute(true);
		MessageContext respMsgCtx =
opClient.getMessageContext("In");
		SOAPEnvelope respEnvelope = respMsgCtx.getEnvelope();





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