Soaphttpclientprotocol, which calls the specified method for formulating the service

Source: Internet
Author: User

1. The soaphttpclientprotocol class can directly access the specified WebService method.

Prerequisites:

    1. You must assign a value to the URL of this class. This URL indicates the specific path of the service.
    2. The specific class must inherit the class.
    3. You must add these features on the inheritance class, especially webservicebinding (name = "Soap", namespace = "http://tempuri.org/")]
    4. Complete features include: [generatedcode ("system. Web. Services", "2.0.50727.3053 "),
      Designercategory ("Code"), debuggerstepthrough,
      Webservicebinding (name = "Soap", namespace = "http://tempuri.org/")]
    5. The call method is as follows:

Take string as the parameter

Public String request (string requestxml)
{

Object [] array = base. Invoke ("request", new object []
{
Requestxml
});
Return (string) array [0];
}

Passing parameters as objects

[System. web. services. protocols. soapdocumentmethodattrispace ("http://tempuri.org/Request", requestnamespace = "http://tempuri.org/", responsenamespace = "http://tempuri.org/", use = system. web. services. description. soapbindinguse. literal, parameterstyle = system. web. services. protocols. soapparameterstyle. wrapped)]
Public jobmsgentity request (entity jme)
{
Object [] Results = This. Invoke ("request", new object [] {
Jme });
Return (entity) (results [0]);
}

Note:

Request: indicates the method to be called.

Requestxml: indicates the input parameter. this parameter is a serialized XML parameter.

The format is similar to the following:

<? XML version = "1.0"?>

<Request>

<Header userid = "120201" requesttype = "flight. Order. flightmessage. sendmessage" asyncrequest = "false" timeout = "0" messagepriority = "3"/>

<Sendmessagerequest>

<Orderid> 511017689 </orderid>

<Message> notification content </message>

<Type> Issue ticket </type>

<Priority> 10 </Priority>

<Sender> System </sender>

<Recipients> CP </recipients>

<Sendcode/>

</Sendmessagerequest>

</Request>

 

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.