0

I am trying to send an xml file to webserver using wget command in unix as below

wget --post-file xyz.xml http://

i am getting 400 bad request error,please help me

  • Could you post the name of the webserver? Maybe test it with "wget --post-file xyz.xml httpbin.org/anything" first, it might be server side problem, command looks OK. That address is a function on a testing server, will return anything you POST to it. – krigl Jan 8 '19 at 14:12
  • http://<serverip>:port#/api/ – jack Jan 8 '19 at 14:17
  • I meant actual address of the server, not the scheme. That '#' doesn't look right, though. 400 often means impossible address, if you really post it like this, try omitting it. Also check server limits (max file size, allowed filename characters etc.), perhaps your connection - ISPs, employers and cheap network gear can do ugly things to unencrypted content. If you're behind proxy, try it from elsewhere, if not, use whatismyipaddress.com/proxy-check to double-check. – krigl Jan 8 '19 at 14:44
0

This is an example of POST to a Webservice to register an IP in an internal Microsoft DNS.

wget --post-file=myxml.xml --header="Content-Type: text/xml; charset=utf-8" --header="SOAPAction: \"http://tempuri.org/IServiziXXX/AddRecordPassLocal\"" http://servizixxx.mydomain.local:810/ServiziXXX.svc

And this is the file myxml.xml <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"> <SOAP-ENV:Body> <ns1:AddRecordPassLocal><ns1:domain>stage.local</ns1:domain><ns1:recordName>my-server-name</ns1:recordName><ns1:ipDestination>192.168.1.1</ns1:ipDestination></ns1:AddRecordPassLocal> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.