RPC-style, Document-style, and webservicesoap in sap webservice Soap

Source: Internet
Author: User

RPC-style, Document-style, and webservicesoap in sap webservice Soap

RPC describes WebSerivce as a method call. That is to say, You need to clearly describe the method called and the name and value of each parameter. To describe these things, the SOAP message must have a unified specification, pointing out that part is the method name, which part is the parameter, and which part is the return value. In other words, the format of the SOAP message called by the RPC method is rule-based and fixed. (For example, each Parameter must correspond to a Part, and the Part name must be consistent with the Parameter name ).
Document describes WebService in the form of Document transmission, as long as your SoapBody contains a legal Xml Document that can be described using Schema, there is no requirement on the specific format (the Schema should be written in the WSDL ).
We can see that the Document format is more flexible-especially when an Xml Document of a specific format needs to be transmitted, RPC Soap messages can also be simulated in the Document format (as long as the Schema is properly defined ). Therefore, the Document method is more widely used (also the default method in. NET ). For Namespace, I think there should be no obvious difference between the two. RPC is usually used in combination with the Encoding mode, which references the Soap namespace. Document only needs to reference the Namespace definition type of XmlSchema.

JAVA accesses webservice through soap

An example I have done:

Import javax. xml. namespace. QName;

Import org. apache. axis. client. Call;
Import org. apache. axis. client. Service;

Import com. yupont. utils. XMLUtil;

Public class ServiceTest {

Public String callSGCCService (String operationName, String inputXML, String serviceName, String serverContextRoot)
{
StringBuilder result = null;
Try {
String endpoint = serverContextRoot + "/services/" + serviceName;
Service service = new Service (); // create a service call)
Call call = (Call) service. createCall (); // create a call object through the service
Call. setTargetEndpointAddress (new java.net. URL (endpoint); // you can specify the service URL.
Call. setOperationName (new QName ("service.yupont.com", operationName ));
Call. setUseSOAPAction (true );
String result1 = (String) call. invoke (new Object [] {inputXML });
System. out. println (result1 );
Result = new StringBuilder (result1 );
Result. append ("@@@@@");
Result. append (XMLUtil. getNodeTxtByNodeName (XMLUtil. strToXML (result1). getRootElement (), "URL "));
}
Catch (Exception e)
{
System. err. println (e. toString ());
}
Return result. toString ();
}

}
You can refer

How does soap work in webservice?

Webservice can be transmitted using the SOAP standard, but it is very troublesome to receive. Now it is simpler to use the restful method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.