NetTalk Central

Author Topic: Webservice problem  (Read 2938 times)

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • Email
Webservice problem
« on: July 04, 2016, 10:11:00 PM »
Hello

In my program and in Web 77 example, the fields appear twice in the documentation

Jari

REST GET (XML)
The following is a sample REST request and response. The placeholders shown need to be replaced with actual values.

Example Request

GET /Database/dbCustomer?ID=value&CountryCode=value&ShipperCode=value&Name=value&Notes=value&Customer_Action=update HTTP/1.1
Host: 127.0.01:90

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<dbCustomer_response xmlns="Database">
  <CustomerDetail>
      <CUS_ID>value</CUS_ID>
      <CUS_COUNTRYCODE>value</CUS_COUNTRYCODE>
      <CUS_SHIPPERCODE>value</CUS_SHIPPERCODE>
      <CUS_NAME>value</CUS_NAME>
      <CUS_ID>value</CUS_ID>
      <CUS_COUNTRYCODE>value</CUS_COUNTRYCODE>
      <CUS_SHIPPERCODE>value</CUS_SHIPPERCODE>
      <CUS_NAME>value</CUS_NAME>

  </CustomerDetail>
</dbCustomer_response>

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Webservice problem
« Reply #1 on: July 05, 2016, 07:05:08 AM »
Hello Jari
  It looks like you are returning a QUEUE or a View (something similar perhaps) and does not have a Record Tag defined.

Cheers @ Urayoan

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • Email
Re: Webservice problem
« Reply #2 on: July 05, 2016, 10:04:35 AM »
Hi Urayoan

In WEB77 press Service-button and then select Database.
Then press  dpProduct-button.

Now you get documentation where fields appears twice:

Service: Database
Method: dbProduct
Parameters
List: Product
PRO_ID (int)
PRO_NAME (string)
PRO_RRP (int)
Parameter is Optional
string: Product_Action
The action to apply to the Product List
Valid Action(s) : insert, get, update, delete, null
Parameter is Optional
Possible Return Data

List: ServiceErrors
ErrorNumber (int)
ErrorPosition (string)
ErrorRecordID (string)
ErrorDescription (string)
ErrorRecomendation (string)
List: ServiceResults
ResultAction (string)
ResultTable (string)
ResultRecordID (string)
ResultDescription (string)
List: ProductDetails
PRO_ID (int)
PRO_NAME (string)
PRO_RRP (int)
SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

Example Request

POST /Database HTTP/1.1
Host: 127.0.0.1:90
Content-Type: text/xml
Content-Length: length
SOAPAction: http://127.0.0.1:90/dbProduct

<?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>
    <dbProduct xmlns="Database">
      <Product>
        <PRO_ID>value</PRO_ID>
        <PRO_NAME>value</PRO_NAME>
        <PRO_RRP>value</PRO_RRP>
      </Product>
      <Product>
        <PRO_ID>value</PRO_ID>
        <PRO_NAME>value</PRO_NAME>
        <PRO_RRP>value</PRO_RRP>
      </Product>
      <Product_Action>update</Product_Action>
    </dbProduct>
  </soap:Body>
</soap:Envelope>

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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>
    <dbProduct_response xmlns="Database">
      <ProductDetails>
          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
      </ProductDetails>
    </dbProduct_response>
  </soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.

Example Request

POST /Database HTTP/1.1
Host: 127.0.0.1:90
Content-Type: application/soap+xml
Content-Length: length

<?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://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <dbProduct xmlns="Database">
      <Product>
        <PRO_ID>value</PRO_ID>
        <PRO_NAME>value</PRO_NAME>
        <PRO_RRP>value</PRO_RRP>
      </Product>
      <Product>
        <PRO_ID>value</PRO_ID>
        <PRO_NAME>value</PRO_NAME>
        <PRO_RRP>value</PRO_RRP>
      </Product>
      <Product_Action>update</Product_Action>
    </dbProduct>
  </soap:Body>
</soap:Envelope>

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?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>
    <dbProduct_response xmlns="Database">
      <ProductDetails>
          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
      </ProductDetails>
    </dbProduct_response>
  </soap:Body>
</soap:Envelope>
HTTP POST (XML)
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.

Example Request

POST /dbProduct HTTP/1.1
Host: 127.0.0.1:90
Content-Type: application/x-www-form-urlencoded
Content-Length: length

ID=value&Name=value&RRP=value&Product_Action=update

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<dbProduct_response xmlns="Database">
  <ProductDetails>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
  </ProductDetails>
</dbProduct_response>
HTTP GET (XML)
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.

Example Request

GET /dbProduct?ID=value&Name=value&RRP=value&Product_Action=update HTTP/1.1
Host: 127.0.0.1:90

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<dbProduct_response xmlns="Database">
  <ProductDetails>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
  </ProductDetails>
</dbProduct_response>
REST GET (XML)
The following is a sample REST request and response. The placeholders shown need to be replaced with actual values.

Example Request

GET /Database/dbProduct?ID=value&Name=value&RRP=value&Product_Action=update HTTP/1.1
Host: 127.0.0.1:90

Example Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<dbProduct_response xmlns="Database">
  <ProductDetails>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
      <PRO_ID>value</PRO_ID>
      <PRO_NAME>value</PRO_NAME>
      <PRO_RRP>value</PRO_RRP>
  </ProductDetails>
</dbProduct_response>

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Webservice problem
« Reply #3 on: July 06, 2016, 06:23:51 AM »
Hello Jari:
  In the example the dbProduct method, in the return section does not have any item tag defined (check the first picture).

Remember, in the documentation having more than one is fine and is information to the users who are gonna consume the web service to let them known that maybe is going to receive more than one record in the response.

Is a way to differentiate a GROUP from a QUEUE, VIEW etc. in the response.

So, after the Item tag is added, the XML looks something like this (sorry about the colors)

<?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>
    <dbProduct_response xmlns="Database">
      <ProductDetails>
        <ProductDetailItem>
          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
        </ProductDetailItem>
        <ProductDetailItem>   
     

          <PRO_ID>value</PRO_ID>
          <PRO_NAME>value</PRO_NAME>
          <PRO_RRP>value</PRO_RRP>
        </ProductDetailItem>
      </ProductDetails>
    </dbProduct_response>
  </soap:Body>

jari@softmade.fi

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • Email
Re: Webservice problem
« Reply #4 on: July 06, 2016, 07:28:57 AM »
Ok

One user pointed out this "problem" but now even I can understand it :)

Thanks

urayoan

  • Full Member
  • ***
  • Posts: 222
    • View Profile
    • AZ Rock Radio
Re: Webservice problem
« Reply #5 on: July 06, 2016, 07:35:36 AM »
Glad the information was helpful

Cheers @ Urayoan