Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)

2008-08-27 Thread jaybytez

Working with Axis2 and REST differs a little based on whether you are doing
POSTs or GETs.  I have been using Axis2 for REST as well as SOAP, but I
don't use code generated stubs.  I am using the ServiceClient to invoke my
services.  In that context, I set the following Options on the ServiceClient
(these depend on GET or POST...GET being the full url with params and the
POST being just the url with params sent in the body of the request):

Options options = new Options();
options.setProperty(HTTPConstants.SO_TIMEOUT, new
Integer(timeout));
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new
Integer(timeout));
options.setProperty(Constants.Configuration.ENABLE_REST,
Boolean.TRUE);
options.setProperty(Constants.Configuration.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_GET);
options.setProperty(Constants.Configuration.MESSAGE_TYPE,
   
org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM);
options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,
Constants.VALUE_TRUE);
options.setCallTransportCleanup(true);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setTo(new EndpointReference(myCustomUrl...based on GET
or POST);

Then when I call sendReceive on the ServiceClient, my param depends on GET
or POST.  For GET, the EndpointReference has all the params so you can send
a null to the sendReceive.  For a POST, you need to send the XML message
onto the sendReceive.

//POST request parameters are in OMElement
mReply=client.sendReceive(myRequest);

//GET request parameters were already appended to
endpoint URL 
// in RestServiceClientHandler (parent class)
mReply=client.sendReceive(null);

This may not answer your questions directly, but I have used this and
successfully integrated Axis2 to call Google's Geocoding Service (GET only)
and Yahoo's Search Service (GET or POST model).

- jay


Nick Steel wrote:
 
 I havn't been able to progress any further with Axis2 and REST, doesn't
 anyone have any ideas about these issues?
 
 Nick
 

-- 
View this message in context: 
http://www.nabble.com/Axis2-REST-client-and-server-questions-%28Data-bindings%2C-Headers%2C-Performance%29-tp19087933p19186773.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Axis2 - Rampart - Using Rampart with ServiceClient without Config file

2008-08-20 Thread jaybytez

We are currently using Axis2 in a Stubless or Dynamic mode through the
ServiceClient class.  I am currently using OpenSAML to build a SAML
Assertion and placing that Assertion into the Head of the message before
sending the message.  Can I do the same thing using Rampart or WSS4J, or is
Rampart specifically managed through its configuration files?

Thanks - jay
-- 
View this message in context: 
http://www.nabble.com/Axis2---Rampart---Using-Rampart-with-ServiceClient-without-Config-file-tp19077932p19077932.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Yahoo's Web Service Search REST (via POST and non-XML data block)

2008-07-30 Thread jaybytez

Do I build the POST URL and put it as the text node of an OMElement and send
that through the ServiceClient or is there a specific formatted XML that I
send to the ServiceClient?  Do I create an XML with children nodes that have
element names equivalent to the param name and text nodes equivalent to the
param value?

If so, where is this documented?

Thanks - jay



keith chapman wrote:
 
 You can set the OMElement into service Client and change its contentType
 as
 follows,
 
 opts.setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA)
 
 This will send the data out as application/form-data which is what yahoo
 expects.
 
 Thanks,
 Keith.
 
 On Thu, Jul 17, 2008 at 12:24 AM, jaybytez [EMAIL PROTECTED] wrote:
 

 I am testing out REST with Axis2 and I believe I have a good handle on
 using
 with GET Method Type.  The problem I am having (in interacting with
 freely
 available REST services) is that services like what are provided by Yahoo
 do
 not create an XML Structure for POST REST services like the Axis2 example
 shows.  Instead Yahoo suggests just putting the parameters into the POST
 body, but the sendAndReceive methods of the ServiceClient only take an
 OMElement.  Does this mean that I cannot use the ServiceClient (and it
 appears RPCServiceClient did not work for me either), unless my POST
 builds
 an XML Body?

 Here is the Yahoo doc:
 http://developer.yahoo.com/search/rest.html#POSTthat
 explains building POST based REST requests.

 Again, I can use the GET functionality...I just want to make sure I
 understand when I would use POST and how that could be done through
 Axis2.

 Thanks - jay.
 --
 View this message in context:
 http://www.nabble.com/Yahoo%27s-Web-Service-Search-REST-%28via-POST-and-non-XML-data-block%29-tp18494234p18494234.html
 Sent from the Axis - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 Keith Chapman
 Senior Software Engineer
 WSO2 Inc.
 Oxygenating the Web Service Platform.
 http://wso2.org/
 
 blog: http://www.keith-chapman.org
 
 

-- 
View this message in context: 
http://www.nabble.com/Yahoo%27s-Web-Service-Search-REST-%28via-POST-and-non-XML-data-block%29-tp18494234p18736630.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Yahoo's Web Service Search REST (via POST and non-XML data block)

2008-07-16 Thread jaybytez

I am testing out REST with Axis2 and I believe I have a good handle on using
with GET Method Type.  The problem I am having (in interacting with freely
available REST services) is that services like what are provided by Yahoo do
not create an XML Structure for POST REST services like the Axis2 example
shows.  Instead Yahoo suggests just putting the parameters into the POST
body, but the sendAndReceive methods of the ServiceClient only take an
OMElement.  Does this mean that I cannot use the ServiceClient (and it
appears RPCServiceClient did not work for me either), unless my POST builds
an XML Body?

Here is the Yahoo doc: http://developer.yahoo.com/search/rest.html#POST that
explains building POST based REST requests.  

Again, I can use the GET functionality...I just want to make sure I
understand when I would use POST and how that could be done through Axis2.

Thanks - jay.
-- 
View this message in context: 
http://www.nabble.com/Yahoo%27s-Web-Service-Search-REST-%28via-POST-and-non-XML-data-block%29-tp18494234p18494234.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Help With Operation Namespace

2008-07-10 Thread jaybytez

I am reposting this to see if anyone ran into this issue.


jaybytez wrote:
 
 I create a ServiceClient to call sendReceive, fireAndForget, sendRobust,
 sendRobustNonBlocking and I utilize the method that takes the QName for
 the WSDL Operation as well as the XML Message to send.  It does not matter
 what I set the QName to, I always am able to send a request and receive a
 response back, even if my QName used in the ServiceClient does not match
 the targetNamespace defined in my WSDL.
 
 After I create the service client, I call a method that contains this
 logic:
 
 if(isMockedService()) {
 mReply =
 client.sendReceive((OMElement)getRequestWrapper().getRequest());
 }
 else {
 mReply = client.sendReceive(new
 QName(webMethod.targetNamespace(),
 webMethod.operationName()),
 (OMElement)getRequestWrapper().getRequest());
 }
 
 The interesting thing is that I can do the following:
 
 if(isMockedService()) {
 mReply =
 client.sendReceive((OMElement)getRequestWrapper().getRequest());
 }
 else {
 mReply = client.sendReceive(new QName(bogusNamespace,
 bogusOperation),
 (OMElement)getRequestWrapper().getRequest());
 }
 
 And I can still successfully invoke the operation defined in the WSDL. 
 Shouldn't this error out that the operation name did not exist in the
 WSDL?
 
 Does this depend on whether I create a ServiceClient with a valid
 serviceName and portName (because right now I set those values to null).
 
 Thanks -jay
 

-- 
View this message in context: 
http://www.nabble.com/ServiceClient-ignores-QName-for-operation-specific-invocation-tp17699113p18391565.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Anonymous ServiceClient - How Does it Know Which Operation to Invoke

2008-06-12 Thread jaybytez

I just have a quick question on a piece of Axis2 that I am not understanding. 
If I have a WSDL with multiple operations and I create an instance of
ServiceClient using the default constructor, not the constructor that passes
in the service name and the port name...which means I have using the
ServiceClient to invoke my service anonymously.  And I call the sendReceive
method that just takes the body of the request, then how does the
ServiceClient know which operation to call in the WSDL?

Thanks -jay
-- 
View this message in context: 
http://www.nabble.com/Anonymous-ServiceClient---How-Does-it-Know-Which-Operation-to-Invoke-tp17803775p17803775.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Is AxisService Thread-Safe?

2008-06-09 Thread jaybytez

So I viewed the example and decided to create instances of AxisService using
AxisService.createClientSideAxisService.  I store the AxisService object in
a static map and use the wsdl url as the key.  This way the AxisService
object is created once per wsdl and the AxisService is used to create the
ServiceClient.

Is the AxisService thread-safe or does it make the concurrent requests
serialized?

Thanks -jay



Michele Mazzucco-2 wrote:
 
 You can reuse the same ServiceClient instance (but be careful -- it's  
 not thread safe) or create  new instances by reusing the same  
 ConfigurationContext (if you use commons-sender be sure to cache the  
 HttpClient and use a custom connection manager). How to set up the  
 second case is shown here [1].
 
 Michele
 
 [1] http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/ 
 integration/test/org/apache/axis2/async/AsyncService2Test.java
 
 
 On 6 Mar 2008, at 22:41, jaybytez wrote:
 

 I have not run a profiler to determine if there are any points  
 within my Axis
 usage that I could optimize through caching...so this question is a  
 shot in
 the dark.

 Is there any recommended thread-safe caching to improve performance  
 and
 overhead?  Would that be done through caching something like the
 AxisService/AxisConfiguration and creating new ServiceClients from  
 these
 cached service and configuration or can I cache the ServiceClient?   
 I am not
 totally sure what types of resources are attached to these objects  
 and if
 caching them would cause any issues.  Any recommendations?

 Thanks,

 Jay
 -- 
 View this message in context: http://www.nabble.com/Caching- 
 ServiceClient-or-AxisService-or-AxisConfiguration- 
 tp15885373p15885373.html
 Sent from the Axis - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Caching-ServiceClient-or-AxisService-or-AxisConfiguration-tp15885373p17742111.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ServiceClient Port Location Versus Options.setTo(EndpointReference)

2008-06-03 Thread jaybytez

I am doing Stubless Web Service Invocation, using the ServiceClient.  I use
the Options to setup information like timeout and also to set where the web
service request should be sent using the Options.setTo(EndpointReference). 
Then I use the AxisService.createClientSideAxisService to create an instance
of the ServiceClient class with the Options I configured passed into it. 
The WSDL that is being used by the ServiceClient has a different location
identified in the serviceName/port that I am utilizing.  It appears that
sometimes the Options.setTo(EndpointReference) does not override the URL
that is located in the WSDL.  I have a developer that runs multiple tests
and the first test always uses the WSDLs port URL and the subsequent posts
uses the Options.setTo(EndpointReference).  Does the
Options.setTo(EndpointReference) override the URL that is found the the
portName being used?

Thanks - jay
-- 
View this message in context: 
http://www.nabble.com/ServiceClient-Port-Location-Versus-Options.setTo%28EndpointReference%29-tp17625643p17625643.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: EntityResolver for WSDL and other Axis Resources

2008-03-31 Thread jaybytez

I did not get a response on this...so I wanted to repost it and see if there
was any information about using an EntityResolver so that some resources
could be stored locally instead of having to retrieve the WSDL (for
instance) everytime the ServiceClient was created.

Thanks,

jay 



jaybytez wrote:
 
 I am currently using the ServiceCLient class to invoke stubless web
 services.  When I create an instance of ServiceClient with the WSDL, is
 the WSDL file internally (to Axis) retrieved and if so, is this done
 through some mechanism where I could register and use an EntityResolver to
 point to local versions of the WSDLs from my Service Client as opposed to
 retrieving these resources from the remote ESB everytime I make a service
 call?
 
 Thanks,
 
 Jay Blanton
 

-- 
View this message in context: 
http://www.nabble.com/EntityResolver-for-WSDL-and-other-Axis-Resources-tp15885370p16396908.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



EntityResolver for WSDL and other Axis Resources

2008-03-06 Thread jaybytez

I am currently using the ServiceCLient class to invoke stubless web services. 
When I create an instance of ServiceClient with the WSDL, is the WSDL file
internally (to Axis) retrieved and if so, is this done through some
mechanism where I could register and use an EntityResolver to point to local
versions of the WSDLs from my Service Client as opposed to retrieving these
resources from the remote ESB everytime I make a service call?

Thanks,

Jay Blanton
-- 
View this message in context: 
http://www.nabble.com/EntityResolver-for-WSDL-and-other-Axis-Resources-tp15885370p15885370.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Caching ServiceClient or AxisService or AxisConfiguration

2008-03-06 Thread jaybytez

I have not run a profiler to determine if there are any points within my Axis
usage that I could optimize through caching...so this question is a shot in
the dark.

Is there any recommended thread-safe caching to improve performance and
overhead?  Would that be done through caching something like the
AxisService/AxisConfiguration and creating new ServiceClients from these
cached service and configuration or can I cache the ServiceClient?  I am not
totally sure what types of resources are attached to these objects and if
caching them would cause any issues.  Any recommendations?

Thanks,

Jay
-- 
View this message in context: 
http://www.nabble.com/Caching-ServiceClient-or-AxisService-or-AxisConfiguration-tp15885373p15885373.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Stubless Web Service Invocation with Databinding

2008-02-15 Thread jaybytez

Can you do Stubless Web Service Invocation with Axis and use a Databinding
framework?  I know you can do the stubless web service invocation by using
its concepts around Axiom to allow the user to build the SOAP Message and
send the request, then receive the response as an OMElement.  But I was
wondering if the other supported databinding frameworks like JiBX or JAXB
could be used in the stubless invocation mode to bind an Object into a SOAP
Message and then bind the SOAP Response into an Object...or do you always
have to do this through generating stubs?  So that way I could provide a
Bean Object to the Axis framework with a reference to a JiBX binding file
and Axis could use this to build the SOAP Request, and the same thing the
opposite way for the response.

Thanks - jay
-- 
View this message in context: 
http://www.nabble.com/Stubless-Web-Service-Invocation-with-Databinding-tp15503125p15503125.html
Sent from the Axis - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]