简体   繁体   中英

How to post data in SOAP web service

I have following XML in which i want to post record in ProductNumber , Quantity , Price .

    <?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <QueryPrices xmlns="xyz">
      <strSessionKey>string</strSessionKey>
      <nDiscountID>int</nDiscountID>
      <objOrderItems>
        <OrderItem>
          <ProductNumber>int</ProductNumber>
          <Quantity>int</Quantity>
          <Price>float</Price>
        </OrderItem>
        <OrderItem>
          <ProductNumber>int</ProductNumber>
          <Quantity>int</Quantity>
          <Price>float</Price>
        </OrderItem>
      </objOrderItems>
    </QueryPrices>
  </soap:Body>
</soap:Envelope>

Create Soap object, and just use addProperty() to pass parameter.

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request .addProperty("key", value);

Dealing with SOAP

in your case:

request.addProperty( "ProductNumber","something");
request.addProperty( "Quantity","something");
request.addProperty( "Price","something");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM