Good evening, Im just starting to learn curl to exceute xml commands, in a Telco a run this command to validate the login to a network element and then execute other commands:
$ curl -v -X POST http://10.74.13.124:8001 -H "Content-Type: text/xml" -d @test_cnUDM.xml
Output yields Error:
* Trying 10.74.13.124...
* TCP_NODELAY set
* Connected to 10.74.13.124 (10.74.13.124) port 8001 (#0)
> POST / HTTP/1.1
> Host: 10.74.13.124:8001
> User-Agent: curl/7.61.1
> Accept: */*
> Content-Type: text/xml
> Content-Length: 239
>
* upload completely sent off: 239 out of 239 bytes
< HTTP/1.1 500 Internal Server Error
< Server: Huawei web server
< Content-Length: 0
This is the xml file:
cat test_cnUDM.xml
soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>
<soapenv:Body>
<LGI>
<ADDRESS>10.74.13.124:8001</ADDRESS>
<OPNAME>USERY</OPNAME>
<PWD>Whatever</PWD>
<HLRSN>1</HLRSN>
</LGI>
</soapenv:Body>
</soapenv:Envelope>
I appreciate your help in advanced
Hi alexcol,
A 500 error is an issue internal to the server and so should be raised with them, however I suspect that the issue could be malformed xml, your file should read
<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>
<soapenv:Body>
<LGI>
<ADDRESS>10.74.13.124:8001</ADDRESS>
<OPNAME>USERY</OPNAME>
<PWD>Whatever</PWD>
<HLRSN>1</HLRSN>
</LGI>
</soapenv:Body>
You seem to have missed the opening angle bracket, and their server doesn't seem to catch a parsing failure (possibly worth raising a case with Huawei or their reseller).
BTW, a cute distraction when checking the meaning of http errors is http://http.cat/${ERROR_NUMBER}
Good evening Skrynesaver, thanks you very much for yoyr anser, uou are totally right, I missed the opening angle bracket, but Ive come with 2 more issues, i modified the script with 3 block tags, 1 to login, the 2nd for query operation and 3rd one to logout, i run but it yield 1 error:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LGI>
<ADDRESS>10.78.28.116:7776</ADDRESS>
<OPNAME>USERY</OPNAME>
<PWD>Whatever</PWD>
<HLRSN>1</HLRSN>
</LGI>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:lst="http://www.huawei.com/HLR9820/LST_CFALL">
<soapenv:Header/>
<soapenv:Body>
<lst:LST_CFALL>
<lst:ISDN>"573156930374"</lst:ISDN>
</lst:LST_CFALL>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LGO>
</LGO>
</soapenv:Body>
</soapenv:Envelope>
Good evening, thank you Skrynesaver for your help, and you are right, I missed the the opening angle bracket and the port was wrong, nom im connected; I modify the script in 3 blocks tags 1st for logn, 2nd for query operation and 3rd logout from network element, i run once again the script and yields an error:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LGI>
<ADDRESS>10.78.28.116:7776</ADDRESS>
<OPNAME>USERY</OPNAME>
<PWD>Whatever</PWD>
<HLRSN>1</HLRSN>
</LGI>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:lst="http://www.huawei.com/HLR9820/LST_CFALL">
<soapenv:Header/>
<soapenv:Body>
<lst:LST_CFALL>
<lst:ISDN>"573156930374"</lst:ISDN>
</lst:LST_CFALL>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<LGO>
</LGO>
</soapenv:Body>
</soapenv:Envelope>
Error:
* upload completely sent off: 721 out of 721 bytes
+++ USCDB 2025-08-03 18:46:06
PGW #092597
%%POST / HTTP/1.1 Host: 10.87.82.120:7776 User-Agent: curl/7.61.1 Accept: */* Content-Type: text/xml Content-Length: 721 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body> <LGI> <ADDRESS>10.87.82.120:7776</ADDRESS> <OPNAME>USERY</OPNAME> <PWD>Whatever</PWD> <HLRSN>1</HLRSN> </LGI></soapenv:Body></soapenv:Envelope>xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:lst="http://www.huawei.com/HLR9820/LST_CFALL"><soapenv:Header/><soapenv:Body> <lst:LST_CFALL> <lst:ISDN>"573156930374"</lst:ISDN> </lst:LST_CFALL> LST CFALL: ISDN="573156930374";%%
RETCODE = 1001 Invalid command <"* CONTENT-TYPE">
- how do i fix this error?
- Obviously in the password parameter PWD is exposed, is there any way to pass tge password not to be hardcoded?
- I appreciate your help in advanced
This is definitely in the realm of the vendors documentation / customer support, it looks as though it’s interpreting the content-type header as a command rather than a header, but beyond that I cannot say.
Good afternoon, got it, thank you very much for your support
Use --netrc or --netrc-file pwfilenam
See man curl
Got it, MadeInGermany, Thank you very much once again for your help