LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicate with 3rd party web service

Solved!
Go to solution

Hi guys,

 

Using the Softwarekey protection system.

 

Now need to communicate with their web service at the following location: https://secure.softwarekey.com/solo/webservices/XmlLicenseService.asmx

 

I want to send commands there and receive data back from within my built application exe to check licence status.

 

I have no idea where to start.  Please help.

 

Softwarekey Web Service.jpgSoftwarekey Web Service_command InfoCheck.jpg

 

 

0 Kudos
Message 1 of 12
(5,888 Views)

As you're making a web-request (HTTP POST), you should use the HTTP Client VIs.

 

Here's a VI Snippet that should get you started:

HTTP Client.png

 

I used the SOAP 1.1 version as an example, in the first two VIs I set a couple of the custom headers that it uses and then finally make the HTTP POST request in the last VI.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 12
(5,820 Views)

Thank you Sam.  I have a few questions.

I wasn't or haven't been able to receive a valid response as yet.

Header:

1. The add header VI requires the "client handle" input. I don't think this http request requires login/authentication. So if I use the Open Handle VI initially (missing from your snippet , what does it actually do?

Clipboard01.jpg2. How do I exactly set up the below SOAP 1.1 header from their sample?  What is "SOAPAction" and what is "Request Type"?  I don't see that in the below sample but understand it's some mandatory field? How do I find out more?

Clipboard02.jpg3. Your Content-Type header field seems to match the sample above. What about Host: secure.softwarekey.com?

4. Is your Header in the correct order or missing something?

 

XML message content:

1. Do I need to set up or define Envelope or Body components of the message below the header?

Clipboard04.jpg2. How do I ensure the HTTP Post VI sends the message in the required SOAP 1.1 format above?

The SoftwareKey reference states the XML input which replaces the blue text in the image above is formatted as follows:

Clipboard03.jpg

 

Finally is there a webserver or some other source I can test all this?  I need to get a proper server response.

 

Thanks very much for your help 🙂

0 Kudos
Message 3 of 12
(5,798 Views)

Also, how do I set up the very first line? As follows:

 

POST /solo/webservices/XmlLicenseService.asmx HTTP/1.1

0 Kudos
Message 4 of 12
(5,795 Views)

The following code NOT WORKING.  VI attached.Licence Web Service_Info Check BD.png

 

0 Kudos
Message 5 of 12
(5,793 Views)
The HTTP Client VIs set up most of the headers for you. The fact you are using the POST VI means that the first line of POST <url> HTTP 1.1 is already set for you. Just like the 'host' header (since that's the web server you're talking to) and the content-length as these are the basic HTTP requirements.

You only need to use the 'Set Header' to set any additional headers (i.e. nonstandard HTTP ones), as I showed in my example. The order of the headers does not matter.

The 'Open Client Handle' is optional if you just use the 'POST' VI on its own - the VI automatically creates a session with default values. If you want to do more advanced functionality (like HTTP AUTH login, verify the server HTTPS credentials or add additional headers) then you need to open a handle first.

The 'body' needs to contain everything as found below the blank line in the documentation (e.g. from <?xml to ...</soap).

As for ensuring your request meets the SOAP 1.1 protocol. Well that's for you to ensure as the programmer!

Finally - if it doesn't work, what error message are you getting? Look at the returned headers/body to see what they contain if you get a response from the server.

There are services that allow you to check/test HTTP requests by using a custom URL. Here's one I found on Google: https://requestb.in/

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 6 of 12
(5,775 Views)
Solution
Accepted by topic author battler.

Thank you Sam.

 

I've had some success with the following code below.  This is because you told me about including all the text from the example in the body of the message and getting it exactly correct.  I now have a response from their service.

Success.png

0 Kudos
Message 7 of 12
(5,764 Views)
Solution
Accepted by topic author battler.

Instead try:

<?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>
<InfoCheck xmlns="http://secure.softwarekey.com/solo/webservices/">
<xml><LicenseInfoCheck xmlns="">
<LicenseID></LicenseID>
<Password></Password>
<ProductID></ProductID>
</LicenseInfoCheck></xml>
</InfoCheck>
</soap:Body>
</soap:Envelope>

0 Kudos
Message 8 of 12
(5,763 Views)

Hello,

 

I two day read about communicate two softwer over web service.

One software is Labview (software A) and second is software B. Labview software A is slave and need to accept order from software B and after finish order software A need return resutls to sofware B.

 

I read  this  topic but this is case when Labview software send xml message and recived respons. I have successfully created a client which call some web service, but I have oposite situation. How I can make web service server which will respons on example this message from some web service client (software B):

This message is example requst to my web services:


<?xml version="1.0"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Header/>
<env:Body>
<bookStatusEvent xmlns="http://www.booksstatus.com/bookeventservice">
<iditem>125</iditem>
<book>107</book>
<status>available</status>
</bookStatusEvent>
</env:Body>
</env:Envelope>

 

For example I need (Labview web service) need to generate this respons (after check and finsih operation inside LabViewMainVI):

**// iditem, book and status is variable inside Labview code which value return to master software which initiates request //**

 

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns: SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<bookStatusEventResponse xmlns="http://www.booksstatus.com/bookeventservice"">
<bookStatusEventResult>
<iditem>125</iditem>
<book>107</book>
<status>OK</status>
</bookStatusEventResult>
</bookStatusEventResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Please, If you can help me with some example or some idea how I can resolve this problem?

 

Thank you.

0 Kudos
Message 9 of 12
(4,981 Views)

Hi,

 

I'm working an requirement for Production line. Need to update the data for every product we testing to an HTTPS server. 

 

I have followed an HTTP communication VI available with us, I didn't get any response from the server. Later i come to know we need to authenticate the certificate before establish the communication. The same is working in Curl tool.

 

If anyone can help me on how to authenticate the certificate using LabVIEW and what functions to use for the same..

 

Thanks in advance

 

 

0 Kudos
Message 10 of 12
(4,262 Views)