Variable name with http post

Hi All

We need to send some messages to our partner. Both uses webMethods IS server. We use version 6.5 and they use 8.

We need to call our partner service using pub.client:http and pass data as byte array in a variable named ‘xmldata’.

These are the steps I performed.

  1. Created the document
  2. converted the document into xmlstring
  3. converted the string to bytes
  4. Called pub.client:http service as post mapping bytes to data/bytes

My issue is how do I pass the value into a variable name.

When I do not set a headers/content-type then I see the incoming variable name as “<?xml version” with string data.

if I set the headers/content-type to ‘text/xml’ then the incoming variable name is ‘node’ but an immediate xmlNodeToDocument fails with the error “com.wm.lang.xml.WMDocumentException: [ISC.0042.9334] XML version must be 1.0”.

I tried to set the varible name under ‘data/args’ it sure passes the variable but without byte data in it.

Can someone direct me on where I am making the mistake.

Thanking you and regards

FKK

This should work:

These are the steps I performed.

  1. Created the document
  2. converted the document into xmlstring
  3. converted the string to bytes
  4. Called pub.client:http service as post mapping bytes to data/bytes (what is the url are you invoking)

Also set a headers/content-type=text/xml and the receiving end/service will have *node object in the pipeline and downstream parsing

Your second option:
I tried to set the varible name under ‘data/args’ it sure passes the variable but without byte data in it.
–>did you set xmldata=%xmldata% (with variable substituion and make sure xmldata in pipeline and not dropped?)

HTH,
RMG

Dear RMG

Thank you for your response.

  1. URL while testing I am using is [URL=“http://ip:5555/invoke/eBankTest:aaa”]http://ip:5555/invoke/eTest:aaa[/URL] just a test service on another server.

  2. headers/content-type=text/xml did give me a *node object at the receiving end. I was now also successfull in parsing the string. But I want the receiving end to be having a variable name ‘xmldata’.

  3. I tried setting xmldata=%xmldata% with varibale substitution and found that it only worked when the data was a string. When byte is used the incoming service had a varible named ‘xmldata’ with a value ‘%xmldata%’ inside it. When you look at the http service you could see that the args variables can only be strings. I did not find a way to mention the datatype other than strings in it.

Any other suggestions.

FKK

Use following steps:

  1. Create the document

  2. convert the document into xmlstring

  3. Call “pub.client,http” by setting following parameters
    url = [url]http://ip:5555/invoke/eTest/aaa[/url]
    method = get or post (as per requirement)
    loadAs = byte
    add new variable as “xmldata” with in the “data/args” and set the value of this using variable substitution (your xmlstring comes here). and just execute the service

  4. Go to the service that you have called. You will be able to see two variable (xmldata & xmldataList) with your xml data.

Dear Amar

You are not converting the string data into bytes during these steps. LoadAs bytes is not converting the data, its for the response value.

In this case I would be getting the input as string at the receiving end and that is not the one expected. They are expecting a byte array with a variable name xmldata.

Hope I had made the question clear.

FKK

As you have already achieved, if you send data after converting it as byte then it will be available in the node object at the receiving service end.

In order to make a key value pair you need to send data as string.