XML send data to a remote server

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

XML send data to a remote server

Pavel | 4000ft
I would like to use lasso 8.6 to perform the below XML action.

<updatePacket>
   <OrderID>[var('OrderID')]</OrderID>
</updatePacket>

It needs to be sent to remote IP:Port.

Any pointers? Excuse my ignorance, no XML experience here.

Thanks


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: XML send data to a remote server

Wade Maxfield
On 11/10/2012, at 11:41 AM, [hidden email] wrote:

> I would like to use lasso 8.6 to perform the below XML action.
>
> <updatePacket>
>   <OrderID>[var('OrderID')]</OrderID>
> </updatePacket>
>
> It needs to be sent to remote IP:Port.
>
> Any pointers? Excuse my ignorance, no XML experience here.
>
> Thanks



I'd fudge the XML by doing a simple string concatenation, then use Include_URL to post it:

Local: 'requestXML' = '<updatePacket>\n\t<OrderID>' + var('OrderID') + '</OrderID>\n</updatePacket>';
Include_URL: "http://1.2.3.4:56/path/to/page", -POSTParams=#requestXML, -timeout=20;


You may need to add a header like:

Local: 'requestXML' = '<?xml version="1.0" encoding="UTF-8"?>\n';
#requestXML += '<updatePacket>\n\t<OrderID>' + var('OrderID') + '</OrderID>\n</updatePacket>';

But that depends on what the other system is expecting.

 - Wade


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: XML send data to a remote server

stevepiercy
In reply to this post by Pavel | 4000ft
     include_url('<a href="http://ipaddress:port/'">http://ipaddress:port/', -postparams(array($myxml)));

XML is a data type, not an action.

Usually one posts XML to a remote URL.  To store the response
from the remote URL:

     local('myresponse' = include_url('<a href="http://ipaddress:port/'">http://ipaddress:port/',
         -postparams(array($myxml))));

Then to show the response for debugging, I wrap it in a text
area so I can see it in a browser (a browser will try to render XML):

     <textarea>[#myresponse]</textarea>

You might also need to convert the XML from a bytes type to a
string type.

     <textarea>[string(#myresponse)]</textarea>

--steve


On 10/10/12 at 6:41 PM, [hidden email] pronounced:

>I would like to use lasso 8.6 to perform the below XML action.
>
><updatePacket>
><OrderID>[var('OrderID')]</OrderID>
></updatePacket>
>
>It needs to be sent to remote IP:Port.
>
>Any pointers? Excuse my ignorance, no XML experience here.
>
>Thanks
>
>
>#############################################################
>This message is sent to you because you are subscribed to
>the mailing list Lasso
>[hidden email]
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: XML send data to a remote server

fletcher sandbeck-2
In reply to this post by Pavel | 4000ft
On Oct 10, 2012, at 3:41 PM, [hidden email] wrote:

> I would like to use lasso 8.6 to perform the below XML action.
>
> <updatePacket>
>   <OrderID>[var('OrderID')]</OrderID>
> </updatePacket>
>
> It needs to be sent to remote IP:Port.
>
> Any pointers? Excuse my ignorance, no XML experience here.

Some more details might help.  If the port is 80 or 443 then [Include_URL] is definitely the answer.  If they want the data sent to another port then something more low level might be required using the [Net] tags.

[fletcher]

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: XML send data to a remote server

Pavel | 4000ft
In reply to this post by Pavel | 4000ft
Fletcher, I went with the NET write

<?LassoScript
Variable: 'request' = '<updateSalePacket>\n<id>' + var('OrderID') + '</id>\n</updateSalePacket>';
Variable: 'Connection' = (Net);
$Connection->(Connect: 'xxx.xxx.xxx.xxx', 10105);
Variable: 'string' = $Connection->(Write: (var:'request'));
$Connection->Close;
?>

Worked like a charm.

Thank you.


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: XML send data to a remote server

Pavel | 4000ft
In reply to this post by Pavel | 4000ft
Wade.
It was submitting the HTML header with it and the receiving end would not take it.
I used the Fletchers low level NET WRITE and it took it.
Thanks.


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>