HTTP post from the C# client is not working..plz help

Hi All,

We have migrated our servers from wM6.1 to wM7.1.2. There is a source system (C # application) which is trying to make an HTTP request to one of our flow service. The input to this flow service is 3 different strings.
Here is the C# client code.

[COLOR=#000080][FONT=Arial]     // Set the Method property of the request to POST.[/font][/color]
[SIZE=2][COLOR=navy][FONT=Arial]       request.Method = "POST";[/font][/color][/size]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // Create POST data and convert it to a byte array.[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       byte[] byteArray = Encoding.UTF8.GetBytes(postData);[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // Set the ContentType property of the WebRequest.[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       request.ContentType = contentType;[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // Set the ContentLength property of the WebRequest.[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       request.ContentLength = byteArray.Length;[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // add request header[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       if (header != "")[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]         request.Headers.Add(header);[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // Get the request stream.[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       Stream dataStream = request.GetRequestStream();[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       // Write the data to the request stream.[/font][/color][/COLOR][/size][/FONT]
[FONT=Arial][SIZE=2][COLOR=navy][COLOR=navy][FONT=Arial]       dataStream.Write(byteArray, 0, byteArray.Length);[/font][/color][/COLOR][/size][/FONT]

This is working fine in our wM6.1 servers.

However, In 7.1.2 server. The client is receiving “403 Forbidden error”. We have checked ACL’s, even gave Administrator access to the user used by client. But its of no use.
When i just have few map steps in the flow service, there is no error. But, when i include any other wM service, then its erroring out with the following message.

Our client is using the content type as text/xml.

Please help, if anyone else had encountered similar problem.


The code snippet shown does include the statments for setting the credentials used to connect to IS.

Also, if(header != “”) should probably be

if(header != null && (header.trim().length() > 0))

Hi Rob,

Thanks for the reply.

The code does pass the credentials for connecting to IS.
Infact same system is able to connect to our 6.1 servers.

In our wM code, we are not doing any content-type parsing. I guess, its not required ?

Infact we are able to connect to our IS (or the concerned service) from our I.E using the same credentials
I had this request raised to SAG also. But no positive result so far.


Rereading the response, here’s what I see:

  • 403 is the default error code returned by IS when any exception is thrown and returned to the HTTP caller–this is not a permission or ACL issue.

  • The XML content handler is trying to consume the optional UTF-8 byte order mark (the removeUTF8BOM call in the stack trace) and is trying to “unread” the first 3 bytes (the UTF-8 BOM is 3 specific bytes) because the BOM wasn’t there. The question now is–why doesn’t the unread work properly?

The likely answer is because there is no input to read. In this case, the read call will return -1, which would be passed to unread–which fails with the index out of bounds error.

Can you provide more info about the service being called? Particularly the declared inputs and what service is internally called when it fails.

The wM service is a very simple service. Infact, its failing for all services (savepipeline, getCurrentDateTime,etc). The very first service in the code is failing.

I just included Map steps in the service. Then there is no error. So basically, whenever it is any service other than map steps, its failing.

When the same source client is calling our wM6.1 service, then there is no error.

The wM service is having 3 strings as its input. When we include savepipelineToFile service, then also its erroring out with the same error.

As stated earlier, we are able to connect and get response from the wM service through internet explorer using the credentials shared with client.

Please let me know, if you can figure out something which i am missing.

Here is the detailed server log, the this HTTP invoke happens.

[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0039.0001D] POST /invoke/ID03.Services/select_Ingredient?location=173&itemcode=00038118[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Content-Type: text/xml[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Content-Length: 0[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Connection: Keep-Alive[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Host: <<HostName>>[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0012.0003T] Client did not provide a session id so creating a new session 280c2bc0fe3d11de8f0afd66251329b6[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0014.0016T] Invoking service ID03.Services:select_Ingredient[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0033.0140T] Removed session 280c2bc0fe3d11de8f0afd66251329b6 [/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> HTTP/1.1 401 [ISS.0084.9004] Access Denied[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> Set-Cookie: ssnid=; path=/;[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> Content-Type: text/html; charset=UTF-8[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> WWW-Authenticate: Basic realm="webMethods"[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> Connection: close[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> Content-Length: 2812[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0039.0001D] POST /invoke/ID03.Services/select_Ingredient?location=173&itemcode=00038118[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Content-Type: text/xml[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Authorization: Basic aWRzOmlkcw==[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Content-Length: 0[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] <-- Host: <<HostName>>[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0012.0003T] Client did not provide a session id so creating a new session 281182f0fe3d11de8f0ce8b1cece4174[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0012.0009T] Successfully authenticated user (ids)[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0014.0016T] Invoking service ID03.Services:select_Ingredient[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0049.0005D] Invoke : index=1 depth=1[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISS.0014.0016T] Invoking service pub.flow:savePipelineToFile[/size]
[SIZE=1]2010-01-11 12:09:08 NZDT [ISC.0038.0002D] --> HTTP/1.1 403 Service Error[/size]


You mention that the service accepts 3 strings. I don’t think a content-type of text/xml is correct. When that content-type is specified, the XML content handler will be invoked and it will expect XML in the body of the post. And the service will be passed a node object in the pipeline.

Why it is working in 6.1 could be due to a number of things. We should try to zero in on what is amiss in 7.1.2.

Thanks Rob for inputs.

To update you further on this issue. We are not facing any issues in 7.1.2 QA (test) IS. Its only failing in our 7.1.2 Prod. Also, this is a migrated package from wM 6.1 env. This package is working fine in wM 6.5 env.

It is so strange that, its failing only in 7.1.2 prod.


Might there be a class conflict of some sort caused by multiple jars somewhere? Check the classpaths of QA and prod. Also verify service packs/fixes are the same in both. And the JVMs.

When you execute the service from a web-browser, you are not sending in XML through a POST. Have you tried to execute as a GET? Have you tried to execute this as just a map step returning a value? Also, what is going on with your error log? If save pipeline worked, there should a way to see what you are getting, otherwise their should be something telling about the content being bad as its input.

So a sample of the XML you are trying to send, a sample of the inputs to the savePipeline, acknowledgement of all the errors you are getting will help out. We understand it works in other places, but that does nothing for us as we can’t step through the code. Good day.

Yemi Bedu