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 Jeff Garrett <je...@gmail.com> on 2008/06/02 17:47:16 UTC

Axis2 w/ HttpClient

Hi all.
I have deployed my web services using Axis2, from an in-house servet
design.  I understand I can use Wsdl2Java and create a stub client for each
service, but I have an existing test package that I would like to keep
as-is.  In this test package, I use the Apache HttpClient to send my request
(my custom SOAP Header, request in SOAP body) to the server.  It worked
perfect for my previous design, but not working well for Axis2.

I am having trouble sending the request from my test package using
HttpClient to my Axis2 service.  I always get the same response " ".  I can
use JMeter to send the request and it works fine (the SOAPAction is always
set to the operation name).  But it does not work when I use the existing
test package as-is.  Does something else need to be set somewhere?  Has
anyone else seen/solved this?

I am sorry if this is posted somewhere.  I took a quick look, but didn't see
anything that solved my problem.

Thanks.
Jeff

Re: Axis2 w/ HttpClient

Posted by Jeff Garrett <je...@gmail.com>.
Problem is solved.  It can be done using an HTTP header.

If anyone comes across this needing the solution, put the following
line of code just before sending the request using the HttpClient,
substitute the variables for your info.

PostMethod post = new PostMethod(URL);
post.setRequestEntity(new
StringRequestEntity(STRING_VERSION_OF_REQUEST, "text/xml", "utf-8"));
post.addRequestHeader("SOAPAction", "\"" + OPERATION + "\"");
CLIENT.executeMethod(post);

Thanks.
Jeff

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


Re: Axis2 w/ HttpClient

Posted by Jeff Garrett <je...@gmail.com>.
Is this an element in the SOAP Header request?  If so, this might make
things very difficult (will explain further if you reply and say that it
is).


Here is a sample of my services.xml for a service (from the wsdl2java
tool).  Just unsubscribe from notificiations.
<service name="NotificationProducerV2">
    <messageReceivers>
      <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="out.NotificationProducerV2MessageReceiverInOut"/>
    </messageReceivers>
    <parameter name="ServiceClass">out.NotificationProducerV2</parameter>
    <parameter name="useOriginalwsdl">true</parameter>
    <parameter name="modifyUserWSDLPortAddress">true</parameter>
    <operation name="unsubscribe" mep="http://www.w3.org/ns/wsdl/in-out">
      <actionMapping>unsubscribe</actionMapping>

<outputActionMapping>address/NotificationProducer/unsubscribeResponse</outputActionMapping>
      <faultActionMapping faultName="unsubscribe">
address/NotificationProducer/unsubscribe/Fault/unsubscribeException<http://www.tmforum.org/mtop/fmw/wsdl/notp/v1/NotificationProducer/unsubscribe/Fault/unsubscribeException>
</faultActionMapping>
    </operation>
  </service>

Just looking at this, the OutputActionMapping might not be right, just what
was compiled from schema.  Should it be something else (
http://localhost:52492/axis2/services/NotificationProducerV2/unsubscribe).

So, I want to send a request and set the SOAPAction element to
"unsubscribe".
Jeff



On Mon, Jun 2, 2008 at 1:35 PM, Michele Mazzucco <Mi...@ncl.ac.uk>
wrote:

> Jeff,
>
> you have to set the SOAP action (required by WS-addressing) as specified
> into your services.xml.
>
>
> Michele
>
>
> On 2 Jun 2008, at 17:01, Jeff Garrett wrote:
>
> Sorry, the response didn't paste right and I over-looked it.
>>
>> Response is "The endpoint reference (EPR) for the Operation not found is
>> /axis2/services/MY_SERVICE and the WSA Action = null"
>>
>> Does something need to be put in the request, either the SOAP header or
>> the HTTP header identifying the operation?  Shouldn't Axis2 be able to
>> figure that out from what is in the SOAP body?
>>
>> Thanks.
>> Jeff
>>
>> On Mon, Jun 2, 2008 at 11:47 AM, Jeff Garrett <
>> jeffrey.s.garrett@gmail.com> wrote:
>> Hi all.
>> I have deployed my web services using Axis2, from an in-house servet
>> design.  I understand I can use Wsdl2Java and create a stub client for each
>> service, but I have an existing test package that I would like to keep
>> as-is.  In this test package, I use the Apache HttpClient to send my request
>> (my custom SOAP Header, request in SOAP body) to the server.  It worked
>> perfect for my previous design, but not working well for Axis2.
>>
>> I am having trouble sending the request from my test package using
>> HttpClient to my Axis2 service.  I always get the same response " ".  I can
>> use JMeter to send the request and it works fine (the SOAPAction is always
>> set to the operation name).  But it does not work when I use the existing
>> test package as-is.  Does something else need to be set somewhere?  Has
>> anyone else seen/solved this?
>>
>> I am sorry if this is posted somewhere.  I took a quick look, but didn't
>> see anything that solved my problem.
>>
>> Thanks.
>> Jeff
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Axis2 w/ HttpClient

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Jeff,

you have to set the SOAP action (required by WS-addressing) as  
specified into your services.xml.


Michele

On 2 Jun 2008, at 17:01, Jeff Garrett wrote:

> Sorry, the response didn't paste right and I over-looked it.
>
> Response is "The endpoint reference (EPR) for the Operation not  
> found is /axis2/services/MY_SERVICE and the WSA Action = null"
>
> Does something need to be put in the request, either the SOAP  
> header or the HTTP header identifying the operation?  Shouldn't  
> Axis2 be able to figure that out from what is in the SOAP body?
>
> Thanks.
> Jeff
>
> On Mon, Jun 2, 2008 at 11:47 AM, Jeff Garrett  
> <je...@gmail.com> wrote:
> Hi all.
> I have deployed my web services using Axis2, from an in-house  
> servet design.  I understand I can use Wsdl2Java and create a stub  
> client for each service, but I have an existing test package that I  
> would like to keep as-is.  In this test package, I use the Apache  
> HttpClient to send my request (my custom SOAP Header, request in  
> SOAP body) to the server.  It worked perfect for my previous  
> design, but not working well for Axis2.
>
> I am having trouble sending the request from my test package using  
> HttpClient to my Axis2 service.  I always get the same response "  
> ".  I can use JMeter to send the request and it works fine (the  
> SOAPAction is always set to the operation name).  But it does not  
> work when I use the existing test package as-is.  Does something  
> else need to be set somewhere?  Has anyone else seen/solved this?
>
> I am sorry if this is posted somewhere.  I took a quick look, but  
> didn't see anything that solved my problem.
>
> Thanks.
> Jeff
>


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


Re: Axis2 w/ HttpClient

Posted by Jeff Garrett <je...@gmail.com>.
Sorry, the response didn't paste right and I over-looked it.

Response is "The endpoint reference (EPR) for the Operation not found is
/axis2/services/MY_SERVICE and the WSA Action = null"

Does something need to be put in the request, either the SOAP header or the
HTTP header identifying the operation?  Shouldn't Axis2 be able to figure
that out from what is in the SOAP body?

Thanks.
Jeff

On Mon, Jun 2, 2008 at 11:47 AM, Jeff Garrett <je...@gmail.com>
wrote:

> Hi all.
> I have deployed my web services using Axis2, from an in-house servet
> design.  I understand I can use Wsdl2Java and create a stub client for each
> service, but I have an existing test package that I would like to keep
> as-is.  In this test package, I use the Apache HttpClient to send my request
> (my custom SOAP Header, request in SOAP body) to the server.  It worked
> perfect for my previous design, but not working well for Axis2.
>
> I am having trouble sending the request from my test package using
> HttpClient to my Axis2 service.  I always get the same response " ".  I can
> use JMeter to send the request and it works fine (the SOAPAction is always
> set to the operation name).  But it does not work when I use the existing
> test package as-is.  Does something else need to be set somewhere?  Has
> anyone else seen/solved this?
>
> I am sorry if this is posted somewhere.  I took a quick look, but didn't
> see anything that solved my problem.
>
> Thanks.
> Jeff
>