How to build a Java web service that receive data via HTTP Post

As above. Thanks.

Regards,
Rachel
zuzzi2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mayank SAssociate Director - Product EngineeringCommented:
Hi Rachel, start with the tutorial: http://java.sun.com/webservices/docs/1.6/tutorial/doc/ 

- Mayank.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mayank SAssociate Director - Product EngineeringCommented:
There are also some code samples here:

http://java.sun.com/developer/codesamples/webservices.html
javaoptimizerCommented:
import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
 
public class Example1_client {
 
  public static void main (String[] args)
       throws Exception {
 
    System.out.println("\n\nCalling the SOAP Server to say hello\n\n");      
    URL url = new URL (args[0]);
    String name = args[1];
 
    Call call = new Call (  );
    call.setTargetObjectURI("urn:Example1");
    call.setMethodName("sayHello");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC;);
    Vector params = new Vector (  );
    params.addElement (new Parameter("name", String.class, name, null));
    call.setParams (params);
 
    System.out.print("The SOAP Server says: ");
 
    Response resp = call.invoke(url, "");
 
    if (resp.generatedFault (  )) {
      Fault fault = resp.getFault (  );
      System.out.println ("\nOuch, the call failed: ");
      System.out.println ("  Fault Code   = " + fault.getFaultCode (  ));
      System.out.println ("  Fault String = " + fault.getFaultString (  ));
    } else {
      Parameter result = resp.getReturnValue (  );
      System.out.print(result.getValue (  ));
      System.out.println(  );
    }
  }
}

for a better understanding look at -> http://www.oreilly.com/catalog/progwebsoap/chapter/ch03.html#62464
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Mayank SAssociate Director - Product EngineeringCommented:
That's only the client :) the Q is about developing the web-service itself. The client could be developed in anything, be it Java or .NET for example.
Leo EikelmanDirector, IT and Business DevelopmentCommented:
well if you are going to use HTTP Post to send data to your web service I suggest building a document style web service (as oppose to an RPC style one)

A web service is basically a public interface with an manual to tell it how to run (the WSDL file)

you can start by looking here
http://java.sun.com/webservices/docs/1.6/tutorial/doc/

http://www.roseindia.net/javacertification/wsd-guide/wsdl_implementation.shtml

I recently completed a document style web service in BEA Weblogic and it is quite easy to create one, as Weblogic creates the WSDL file for you.  

If you are programming in Weblogic you can start by looking here:

http://edocs.bea.com/wls/docs81/webserv/index.html

Cheers
Leo EikelmanDirector, IT and Business DevelopmentCommented:
that's fine with me

Leo
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.