View previous topic :: View next topic
|
Author |
Message |
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
I have written a COBOL code that can access a webservice from mainframes. The input that is sent from COBOL code is SOAP XML [through variables holding XML is bits and parts].
The data is being sent without any truncation and is being received without any issue with truncation. But I am always receiving a XML that states as below
"HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Dat
e: Wed, 16 May 2018 *********** Connection: close Content-Length: 326 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" C
ontent="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request - Invalid Verb</h2> <hr><p>HTTP Error 400. The requ
est verb is invalid.</p> </BODY></HTML>"
I do understand that the server is not able to understand the XML request that I have sent. If my understanding is correct, then can you please let me know if there is anyway to get out of it. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
can you please let me know if there is anyway to get out of it. |
Yes - find and fix the invalid code. Start by displaying in your code EXACTLY what is being sent. Take that text, put it in a browser, and see what the server shows you when you manually try it. Validate that you don't have things in the text to cause issues (such as an ampersand). Talk to your network support group and verify you're not having a gateway timeout (which sometimes gets reported as an error 400). The message indicates an invalid verb -- are you attempting to do a GET or PUT?
Quote: |
The data is being sent without any truncation and is being received without any issue with truncation. |
There is no indication in the message of truncation, so why do you think this is an issue? |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
Robert Sample wrote: |
Quote: |
can you please let me know if there is anyway to get out of it. |
Yes - find and fix the invalid code. Start by displaying in your code EXACTLY what is being sent. Take that text, put it in a browser, and see what the server shows you when you manually try it. Validate that you don't have things in the text to cause issues (such as an ampersand). Talk to your network support group and verify you're not having a gateway timeout (which sometimes gets reported as an error 400). The message indicates an invalid verb -- are you attempting to do a GET or PUT?
Quote: |
The data is being sent without any truncation and is being received without any issue with truncation. |
There is no indication in the message of truncation, so why do you think this is an issue? |
Sure Robert. I have already tried displaying the message being sent from our end and what is received and then translated.
But no clue of what is going wrong. Will check on the same once again. |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
Robert Sample wrote: |
The message indicates an invalid verb -- are you attempting to do a GET or PUT? |
I am trying to POST and then listen the socket for response.
Do we need to use GET or PUT keyword in the SOAP XML that we send via EZASOKET?
Can you please help me understand. |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
I wonder that my REXX is able to hit the web service and get the right output using the same SOAP envelope that i have used in the COBOL program, but COBOL program is not able to fetch the output from webservice.
Only difference that i can find from my REXX and COBOL is that, in REXX and COBOL i am trying to use the IP address to connect to the server but later while posting the SOAP evvelope, in my REXX i am POSTing it to the exact path as in URL but in COBOL EZASOKET I could not find option on how to do the same.
Let me explain with an example as in what i meant above,
xyxz.globally.com/dummy.otg.garage.web.services/myservice.asmx is the complete webservice URL.
I tried to connect to the IP address of this webservice in both REXX and COBOL.
But in REXX while writing the socket with SOAP ENVELOPE, i am using POST /dummy.otg.garage.web.services/myservice.asmx
But in COBOL after getting the connection established with the socket, i am trying to write the SOAP envelope with the same content but it s not giving the response.
What I suspect from this is, since in COBOL i am not able to point out to the exact service that i am looking for, instead i am passing my query to xyxz.globally.com [IP address of this URL] and it is not able to understand my query?
Is my suspection correct?
Underlying point is that IP address will not change based on the path but remains same for a base DNS.
If yes then how can i point to the complete URL to access the service. So is this something that i need to worry about.
PS: If i had poured in my thoughts and confused you, then please feel free to raise it so i can clarify to seek your support. |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
Thanks all for your time. The issue has been resolved due to a small ASCII character that made me to test the code again and again.
Without CRLF character the server cannot understand the end of line, hence the issue. |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
I am trying to decode ASCII stream that i received from a service in mainframe into EBCDIC format using EZACIC05.
Everything is running as expected but & is decoded as & in EBCDIC.
Can someone help or pour your insight on this? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
I've never heard of an ASCII to EBCDIC conversion that changes & to & -- but I have run into & in HTML documents. If your source is HTML, then it is likely that HTML is causing you the problem.
Have you looked into the source on the other system to see what is present there? |
|
Back to top |
|
|
vaibhav gs
New User
Joined: 05 Apr 2018 Posts: 17 Location: INDIA
|
|
|
|
Thanks Robert, then I was diverted assuming its the conversion issue!
The source is having & but the output is &
As you mentioned I am transporting data using XML [HTTP 1.1] and so would be the issue with &?
Is there any solution to overcome issue by converting this & with & ? or should we handle the same in the code using some logic to replace it explicitly? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
According to the Enterprise COBOL Version 5.1.1 Programming Guide manual (page 538), CONTENT-CHARACTER should contain the string with & replaced by an & after the XML parsing is done. It's been too long since I last did an XML PARSE to remember if that is truly the case. |
|
Back to top |
|
|
elixir1986
New User
Joined: 10 Nov 2015 Posts: 45 Location: USA
|
|
|
|
Hi,
I am pondering the possibilities on hitting the web service without intervention of db2. Currently using sql mentioned below,
Code: |
select
db2xml.soaphttpnv
(:internet protocol address,:webservice link,:soap xml schema
structure)
into :varchar-output
from sysibm.sysdummy1
end-exec. |
This thread provided information of access webservice. Could you please tell if the web service was accessed from batch or online mode?
Also, similar to the snippet I have provided, if you could provide me on accessing web service in batch mode without using db2, it would be great. |
|
Back to top |
|
|
|