Solved

SOAP API setup

  • 5 April 2023
  • 3 replies
  • 231 views

Userlevel 3
Badge +1

Hi, 

I have some trouble setting up a SOAP API within the RSD file. 

The envelope returns data as follows : 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<getCertificateListByCompanyResponse xmlns="http://tempuri.org/">
<getCertificateListByCompanyResult xmlns:a="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:ObtainedCertificate>
<a:CategoryName>text1</a:CategoryName>
<a:CertificateCode>12345</a:CertificateCode>
<a:CertificateID>12345</a:CertificateID>
<a:CertificateName>text2</a:CertificateName>
<a:CertificateNumber/>
<a:DateAssigned>12345</a:DateAssigned>
<a:DateExpire/>
<a:DateObtained>12345</a:DateObtained>
<a:Expired>false</a:Expired>
<a:Filename/>
<a:Guid>guid1</a:Guid>
<a:ID>12345</a:ID>
<a:Outdated>true</a:Outdated>
<a:ParentID>12345</a:ParentID>
<a:TopID>12345</a:TopID>
<a:UserCode>12345</a:UserCode>
</a:ObtainedCertificate>
<a:ObtainedCertificate>....</a:ObtainedCertificate>

So the Xpath to CategoryName is
 /Envelope/Body/getCertificateListByCompanyResponse/getCertificateListByCompanyResult/ObtainedCertificate/CategoryName

I have everything working in SOAPUI, where I use the following: 
 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:getCertificateListByCompany>
<!--Optional:-->
<tem:p_CompanyID>12345</tem:p_CompanyID>
<!--Optional:-->
<tem:p_Hash>KEY</tem:p_Hash>

</tem:getCertificateListByCompany>
</soapenv:Body>
</soapenv:Envelope>

But in my RSD file, I can't seem to get any data:
 

<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from XML. -->
<api:info title="2" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<!-- You can modify the name, type, and column size here. >
<attr name="Field1" xs:type="string" readonly="false" other:xPath="/item/Field1" />
<attr name="Field2" xs:type="string" readonly="false" other:xPath="/item/Field2" />
<attr name="Field3" xs:type="string" readonly="false" other:xPath="/item/Field3" /-->


<attr name="CategoryName" xs:type="string" readonly="false" other:xPath="/Envelope/Body/getCertificateListByCompanyResponse/getCertificateListByCompanyResult/ObtainedCertificate/CategoryName"/>
<!--attr name="CertificateCode" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/CertificateCode"/>
<attr name="CertificateID" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/CertificateID"/>
<attr name="CertificateName" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/CertificateName"/>
<attr name="CertificateNumber" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/CertificateNumber"/>
<attr name="DateAssigned" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/DateAssigned"/>
<attr name="DateExpire" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/DateExpire"/>
<attr name="DateObtained" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/DateObtained"/>
<attr name="Expired" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/Expired"/>
<attr name="Filename" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/Filename"/>
<attr name="Guid" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/Guid"/>
<attr name="ID" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/ID"/>
<attr name="Outdated" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/Outdated"/>
<attr name="ParentID" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/ParentID"/>
<attr name="TopID" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/TopID"/>
<attr name="UserCode" xs:type="string" readonly="false" other:xPath="/getCertificateListByCompanyResult/ObtainedCertificate/UserCode"/-->







</api:info>

<api:set attr="DataModel" value="DOCUMENT" />
<api:set attr="PushAttributes" value="true" />
<api:set attr="EnablePaging" value="true" />

<api:set attr="Header:Name#" value="SOAPAction"/>
<api:set attr="URI" value="https://sl.plusport.com/Academy.svc?Wsdl" />

<api:set attr="XPath" value="/getCertificateListByCompanyResponse/getCertificateListByCompanyResult" />
<api:set attr="method" value="POST"/>
<api:set attr="Header:Name" value="Content-Type" />
<api:set attr="Header:Value" value="text/xml" />

<api:set attr="data">
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:uen="uen:esws">
<soapenv:Header/>
<soapenv:Body>
<tem:getCertificateListByCompany>
<!--Optional:-->
<tem:p_CompanyID>12345</tem:p_CompanyID>
<!--Optional:-->
<tem:p_Hash>KEY</tem:p_Hash>

</tem:getCertificateListByCompany>
</soapenv:Body>

</soapenv:Envelope>
</api:set>
<api:set attr="XPath" value="/Envelope/Body/" />

<!-- The GET method corresponds to SELECT. Here you can override the default processing of the SELECT statement. The results of processing are pushed to the schema's output. See SELECT Execution for more information. -->
<api:script method="GET">
<api:set attr="method" value="GET"/>
<api:call op="xmlproviderGet">
<api:push/>
</api:call>
</api:script>
</api:script>

 

Do you happen to see any mistakes I made? 

 

Any help would be appreciated!

icon

Best answer by sierd.zuiderveld 28 June 2023, 11:57

View original

3 replies

Userlevel 6
Badge +5

Hi Sierd

Can you send the RSD file to me, I would like to look at it and possibly add some suggestions?

You can send it to me directly on an email, or share it here if it does not go against privacy agreements.

Userlevel 3
Badge +1

We got it to work, for others as reference, here is the RSD file: 

Hi Sierd

Thank you for posting the solution to your problem here. I’m in the situation of investigating how to set up an integration to a SOAP API and this seems to answer the questions that I had. :)

Reply