Hi Tomek,

Thanks for help. I tried the following based on what you said:

HttpClientParams params = new HttpClientParams();
params.setParameter(Channel.USERNAME,"ibuchh");
params.setParameter(Channel.PASSWORD,"shadab");
AWSECommerceServiceClient client = new AWSECommerceServiceClient();
AWSECommerceServicePortType port =   client.getAWSECommerceServicePort();
Client c = Client.getInstance(port);
c.setProperty(CommonsHttpMessageSender.HTTP_PROXY_HOST,"212.138.39.66");
c.setProperty(CommonsHttpMessageSender.HTTP_PROXY_PORT,"8080");
c.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS, params);
...
...
ItemSearchResponse response = port.itemSearch(itemSearch);
...
...
and when I run this class I get the following exceptions.  Your further help
is appreciated. I would be happy if I get XFire run with amazon ws.





Jan 11, 2007 3:18:17 PM
org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: basic authentication scheme selected
Jan 11, 2007 3:18:17 PM org.apache.commons.httpclient.HttpMethodDirector
processProxyAuthChallenge
INFO: No credentials available for BASIC 'KSU Proxy
Server'@212.138.39.66:8080
Jan 11, 2007 3:18:17 PM org.codehaus.xfire.transport.http.HttpChannel
sendViaClient
SEVERE: Server returned error code = 407 for URI :
http://soap.amazon.com/onca/soap?Service=AWSECommerceService. Check server
logs for details
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested
exception is org.codehaus.xfire.fault.XFireFault: Server returned error code
= 407 for URI :
http://soap.amazon.com/onca/soap?Service=AWSECommerceService. Check server
logs for details
org.codehaus.xfire.fault.XFireFault: Server returned error code = 407 for
URI : http://soap.amazon.com/onca/soap?Service=AWSECommerceService. Check
server logs for details
        at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at 
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy13.itemSearch(Unknown Source)
        at edu.ksu.sa.ws.WebServicesClient.main(WebServicesClient.java:112)
Caused by: org.codehaus.xfire.XFireRuntimeException: Server returned error
code = 407 for URI :
http://soap.amazon.com/onca/soap?Service=AWSECommerceService. Check server
logs for details
        at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:130)
        at 
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        ... 5 more

Tomek Sztelak wrote:
> 
> On amazonWS instance.
> 
> On 1/10/07, Irshad Buchh <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>> Thanks very much for quick response.  The eclipse plugin created these:
>>
>> AWSECommerceServiceClient
>> AWSECommerceServiceImpl
>> AWSECommerceServicePortType
>>
>> I get the interface like this:
>>
>> AWSECommerceServiceClient client =   new AWSECommerceServiceClient();
>> AWSECommerceServicePortType amazonWS  =
>> client.getAWSECommerceServicePort();
>>
>> Where do I set up the proxy properties (proxy host, port, username,
>> password) as mentioned on the link that u pointed out?
>>
>> Appreciate your help.
>>
>> --Irshad.
>>
>>
>> Tomek Sztelak wrote:
>> >
>> > Hi
>> >
>> > On 1/10/07, Irshad Buchh <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Thanks for the info. I fixed the classpath as you mentioned. Now when
>> I
>> >> try
>> >> it again, I get the following error. I have T1 internet connection
>> >> through a
>> >> proxy server that I have set through eclipse.
>> >
>> > Try setting proxy location on generated client as described in
>> > http://xfire.codehaus.org/HTTP+Transport ( Proxy Support part )
>> >
>> >> --Irshad.
>> >>
>> >> Jan 10, 2007 12:07:04 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: I/O exception (java.net.ConnectException) caught when processing
>> >> request: Connection timed out: connect
>> >> Jan 10, 2007 12:07:04 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: Retrying request
>> >> Jan 10, 2007 12:07:25 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: I/O exception (java.net.ConnectException) caught when processing
>> >> request: Connection timed out: connect
>> >> Jan 10, 2007 12:07:25 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: Retrying request
>> >> Jan 10, 2007 12:07:46 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: I/O exception (java.net.ConnectException) caught when processing
>> >> request: Connection timed out: connect
>> >> Jan 10, 2007 12:07:46 PM
>> org.apache.commons.httpclient.HttpMethodDirector
>> >> executeWithRetry
>> >> INFO: Retrying request
>> >> Jan 10, 2007 12:08:07 PM org.codehaus.xfire.transport.http.HttpChannel
>> >> sendViaClient
>> >> SEVERE: java.net.ConnectException: Connection timed out: connect
>> >> org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
>> >> Nested
>> >> exception is org.codehaus.xfire.fault.XFireFault: Couldn't send
>> message.
>> >> org.codehaus.xfire.fault.XFireFault: Couldn't send message.
>> >>         at
>> >> org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
>> >>         at
>> >>
>> org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:30)
>> >>         at
>> >>
>> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
>> >>         at
>> >> org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
>> >>         at org.codehaus.xfire.client.Client.invoke(Client.java:335)
>> >>         at
>> >> org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
>> >>         at
>> >> org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
>> >>         at $Proxy13.itemSearch(Unknown Source)
>> >>         at
>> >> edu.ksu.sa.ws.WebServicesClient.main(WebServicesClient.java:92)
>> >> Caused by: org.codehaus.xfire.XFireException: Couldn't send message.
>> >>         at
>> >>
>> org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:145)
>> >>         at
>> >>
>> org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
>> >>         at
>> >>
>> org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
>> >>         ... 7 more
>> >> Caused by: java.net.ConnectException: Connection timed out: connect
>> >>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>> >>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>> >>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>> >>         at java.net.PlainSocketImpl.connect(Unknown Source)
>> >>         at java.net.SocksSocketImpl.connect(Unknown Source)
>> >>         at java.net.Socket.connect(Unknown Source)
>> >>         at java.net.Socket.connect(Unknown Source)
>> >>         at java.net.Socket.<init>(Unknown Source)
>> >>         at java.net.Socket.<init>(Unknown Source)
>> >>         at
>> >>
>> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
>> >>         at
>> >>
>> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
>> >>         at
>> >>
>> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
>> >>         at
>> >>
>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321)
>> >>         at
>> >>
>> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
>> >>         at
>> >>
>> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>> >>         at
>> >>
>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
>> >>         at
>> >>
>> org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:260)
>> >>         at
>> >>
>> org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
>> >>         ... 9 more
>> >>
>> >>
>> >>
>> >>
>> >> Christopher Moesel wrote:
>> >> >
>> >> > Irshad--
>> >> >
>> >> > You need to include the http-client jar in your classpath.  XFire
>> needs
>> >> > this to actually make the http requests to the service.
>> >> >
>> >> > You should be able to find this in the xfire distribution in the lib
>> >> > directory:
>> >> > commons-httpclient-3.0.jar
>> >> >
>> >> > After you do this, if you run into other NoClassDefFoundErrors, it's
>> >> > likely that you're missing other dependencies too-- all of which you
>> >> > should be able to find in the xfire dist's lib directory.
>> >> >
>> >> > -Chris
>> >> >
>> >> > -----Original Message-----
>> >> > From: Irshad Buchh [mailto:[EMAIL PROTECTED]
>> >> > Sent: Tuesday, January 09, 2007 9:04 AM
>> >> > To: [email protected]
>> >> > Subject: [xfire-user] XFire with amazon webservices.
>> >> >
>> >> >
>> >> > Hi,
>> >> >
>> >> > I just used eclipse xfire plugin to generate java code from amazon
>> ec
>> >> > webservice. The code generation was just fine. Now I tried to create
>> a
>> >> > client class with the following code. When I run this class I get
>> the
>> >> > following errors. Where is the problem?
>> >> >
>> >> >
>> >> >
>> >> > Exception in thread "main" java.lang.NoClassDefFoundError:
>> >> > org/apache/commons/httpclient/methods/RequestEntity
>> >> >       at java.lang.Class.getDeclaredConstructors0(Native Method)
>> >> >       at java.lang.Class.privateGetDeclaredConstructors(Unknown
>> >> > Source)
>> >> >       at java.lang.Class.getConstructor0(Unknown Source)
>> >> >       at java.lang.Class.getConstructor(Unknown Source)
>> >> >       at
>> >> >
>> >>
>> org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.
>> >> > java:108)
>> >> >       at
>> >> >
>> org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
>> >> >       at
>> >> >
>> >>
>> org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
>> >> > :26)
>> >> >       at
>> >> >
>> >>
>> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
>> >> > 31)
>> >> >       at
>> >> > org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
>> >> >       at org.codehaus.xfire.client.Client.invoke(Client.java:335)
>> >> >       at
>> >> >
>> org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
>> >> >       at
>> >> > org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
>> >> >       at $Proxy10.itemSearch(Unknown Source)
>> >> >       at
>> >> > edu.ksu.sa.ws.WebServicesClient.main(WebServicesClient.java:90)
>> >> >
>> >> > CLIENT CLASS:
>> >> >
>> >> >
>> >> > mport java.net.MalformedURLException;
>> >> > import java.util.List;
>> >> >
>> >> > import org.apache.commons.logging.Log;
>> >> > import org.apache.commons.logging.LogFactory;
>> >> > import org.codehaus.xfire.XFire;
>> >> > import org.codehaus.xfire.XFireFactory;
>> >> > import org.codehaus.xfire.client.XFireProxyFactory;
>> >> > import org.codehaus.xfire.jaxb2.JaxbServiceFactory;
>> >> > import org.codehaus.xfire.service.Service;
>> >> > import org.codehaus.xfire.service.binding.ObjectServiceFactory;
>> >> >
>> >> > import com.amazon.webservices.awsecommerceservice._2006_11_14.Help;
>> >> > import
>> >> > com.amazon.webservices.awsecommerceservice._2006_11_14.HelpResponse;
>> >> > import com.amazon.webservices.awsecommerceservice._2006_11_14.Item;
>> >> > import
>> >> > com.amazon.webservices.awsecommerceservice._2006_11_14.ItemLookup;
>> >> > import
>> >> >
>> >>
>> com.amazon.webservices.awsecommerceservice._2006_11_14.ItemLookupRequest
>> >> > ;
>> >> > import
>> >> >
>> >>
>> com.amazon.webservices.awsecommerceservice._2006_11_14.ItemLookupRespons
>> >> > e;
>> >> > import
>> >> > com.amazon.webservices.awsecommerceservice._2006_11_14.ItemSearch;
>> >> > import
>> >> >
>> >>
>> com.amazon.webservices.awsecommerceservice._2006_11_14.ItemSearchRequest
>> >> > ;
>> >> > import
>> >> >
>> >>
>> com.amazon.webservices.awsecommerceservice._2006_11_14.ItemSearchRespons
>> >> > e;
>> >> > import com.amazon.webservices.awsecommerceservice._2006_11_14.Items;
>> >> > import
>> com.amazon.webservices.awsecommerceservice._2006_11_14.Request;
>> >> >
>> >> > /**
>> >> >  * @author irshad
>> >> >  *
>> >> >  */
>> >> > public class WebServicesClient {
>> >> > protected final static Log log =
>> >> > LogFactory.getLog(WebServicesClient.class.getName());
>> >> >       /**
>> >> >        * @param args
>> >> >        */
>> >> >       public static void main(String[] args) {
>> >> >               // TODO Auto-generated method stub
>> >> >
>> >> >
>> >> >           Service serviceModel = new
>> >> >
>> >>
>> ObjectServiceFactory().create(edu.ksu.sa.ws.AWSECommerceServicePortType.
>> >> > class);
>> >> >           log.debug("callSoapServiceLocal(): got service model." );
>> >> >
>> >> >           //Create a proxy for the deployed service
>> >> >           XFire xfire = XFireFactory.newInstance().getXFire();
>> >> >           XFireProxyFactory factory = new XFireProxyFactory(xfire);
>> >> >
>> >> >
>> >> >           String serviceUrl =
>> >> > "http://webservices.amazon.com/AWSECommerceService";;
>> >> >
>> >> >           edu.ksu.sa.ws.AWSECommerceServicePortType client = null;
>> >> >           try {
>> >> >               client = (edu.ksu.sa.ws.AWSECommerceServicePortType)
>> >> > factory.create(serviceModel, serviceUrl);
>> >> >           } catch (MalformedURLException e) {
>> >> >               log.error("WsClient.callWebService(): EXCEPTION: " +
>> >> > e.toString());
>> >> >           }
>> >> >
>> >> >           //Invoke the service
>> >> >           String serviceResponse = "";
>> >> >
>> >> >
>> >> >               ItemSearchRequest request = new ItemSearchRequest();
>> >> >
>> >> >               request.setSearchIndex("Books");
>> >> >               request.setPower("title");
>> >> >               //request.settrsetResponseGroup = new String[] {
>> "Small"
>> >> > };
>> >> >               request.setSort("salesrank");
>> >> >
>> >> >               ItemSearchRequest[] requests = new ItemSearchRequest[]
>> {
>> >> > request };
>> >> >
>> >> >               ItemSearch itemSearch = new ItemSearch();
>> >> >               itemSearch.setSubscriptionId("0525E2PQ81DD7ZTWTK82");
>> >> >               itemSearch.setShared(request);
>> >> >
>> >> >               try
>> >> >               {
>> >> >               ItemSearchResponse response =
>> >> > client.itemSearch(itemSearch);
>> >> >               Items info = response.getItems().get(0);
>> >> >               List items = info.getItem();
>> >> >
>> >> >               for (int i = 0; i < items.size(); i++)
>> >> >               {
>> >> >               Item item =(Item) items.get(i);
>> >> >               System.out.println(item.getASIN());
>> >> >               }
>> >> >               }
>> >> >               catch (Exception ex)
>> >> >               {
>> >> >               ex.printStackTrace();
>> >> >               }
>> >> >
>> >> > //            Create a metadata of the service
>> >> >
>> >> >       }
>> >> >
>> >> >
>> >> >
>> >> >       }
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >>
>> http://www.nabble.com/XFire-with-amazon-webservices.-tf2946121.html#a823
>> >> > 8193
>> >> > Sent from the XFire - User mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe from this list please visit:
>> >> >
>> >> >     http://xircles.codehaus.org/manage_email
>> >> >
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe from this list please visit:
>> >> >
>> >> >     http://xircles.codehaus.org/manage_email
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/XFire-with-amazon-webservices.-tf2946121.html#a8254231
>> >> Sent from the XFire - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >
>> >
>> > --
>> > -----
>> > When one of our products stops working, we'll blame another vendor
>> > within 24 hours.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list please visit:
>> >
>> >     http://xircles.codehaus.org/manage_email
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/XFire-with-amazon-webservices.-tf2946121.html#a8254850
>> Sent from the XFire - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
> 
> 
> -- 
> -----
> When one of our products stops working, we'll blame another vendor
> within 24 hours.
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/XFire-with-amazon-webservices.-tf2946121.html#a8276380
Sent from the XFire - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to