This is probably a newbie question, as I have just started working with the HTTPClient.

The question is that I know that the following line placed in a browser address line will return what I want.

http://api.creativecommons.org/rest/license/standard/issue?answers=%3Canswers%3E%0A%3Clicense-standard%3E%3Cderivatives%3Esa%3C%2Fderivatives%3E%0A%3Ccommercial%3Ey%3C%2Fcommercial%3E%0A%3Cjurisdiction%3Epl%3C%2Fjurisdiction%3E%0A%3C%2Flicense-standard%3E%0A%3C%2Fanswers%3E%0A

So I have created a simple HTTPClient app to call the web service. The following is the code that I have generated using examples that I have found that attempt to do what I was hoping would give me the results that I wanted.

public class LicenseCCWebService implements Serializable {

   /**
    * @param args
    */
   public static void main(String[] args) {
       int serviceStatusCode;
String serviceAddress = "http://api.creativecommons.org/rest/license/standard/issue";; String serviceParamaters = ("<license-standard><derivatives>sa</derivatives><commercial>y</commercial><jurisdiction>pl</jurisdiction></license-standard>");
       HttpClient serviceClient = new HttpClient();
       HttpMethod serviceMethod = new GetMethod(serviceAddress);
serviceClient.getParams().setParameter("<license-standard><derivatives>sa</derivatives><commercial>y</commercial><jurisdiction>pl</jurisdiction></license-standard>", new DefaultHttpMethodRetryHandler());
       System.out.println(serviceParamaters);
try {
            serviceStatusCode = serviceClient.executeMethod(serviceMethod);
             if (serviceStatusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + serviceMethod.getStatusLine());
               }
       } catch (HttpException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
       try {
           System.out.println(serviceMethod.getResponseBodyAsString());
       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
   }

}

The result of running the application is:
Method failed: HTTP/1.1 500 Internal Server Error
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
       "http://www.w3.org/TR/REC-html40/strict.dtd";>
<html>
<head><title>Internal Server Error</title></head>
<body>
<h1>Internal Server Error</h1>
<p>An internal error occurred while handling your request.</p>

<p>The server administrator should have been notified of the problem.
You may wish to contact the server administrator ([no address given]) and inform them of
the time the error occurred, and anything you might have done to trigger
the error.</p>

<p>If you are the server administrator, more information may be
available in either the server's error log or Quixote's error log.</p>
</body>
</html>

I must be doing something wrong. The issue I have are:
   I don't know enough to debug what is going wrong
I cannot figure out how to see what the actual method/parameters are so that I can compare to the working method call.

I am using the HTTPClient to make the call to the web service because I need to pass domain authentication a firewall to allow for the call to pass-thru the firewall with authentication. Help would be greatly appreciated and advice on how to best make this type of service call is welcome.
Regards
Wayne


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

Reply via email to