0

guys I'm trying to send an HTTP Post request to a webservice with raw/command line cURL passing an XML string

This is the XML I am trying to pass (values are fake)

<?xml version='1.0' encoding='UTF-8'?>
<soap-env:Envelope xmlns:soap-env='http://schemas.xmlsoap.org/soap/envelope/'>
<soap-env:Body>
    <m:F2bAcaoCobranca xmlns:m='http://www.f2b.com.br/soap/wsbillingaction.xsd'>
        <mensagem data='2005-04-18' numero='222555333'/>
        <cliente conta='90240728366170132' senha='54226484'/>
        <acao_cobranca numero='153079' cancelar_cobranca='1' registrar_pagamento='0' registrar_pagamento_valor='' dt_registrar_pagamento='' cancelar_multa='0' permitir_pagamento='0' dt_permitir_pagamento='' reenviar_email='0' email_tosend=''/>
        <acao_agendamento numero='123' cancelar_agendamento='0'/>
    </m:F2bAcaoCobranca>
</soap-env:Body>

And this is the webservice's URL

http://www.f2b.com.br/WSBillingAction

So I tried many things. Firstly I put the URL at the beginning and the XML string at the ending and it said the < wasn't expected as part of a URL. So I changed positions and this was the last attempt

curl -X POST -d "XML STRING" \ http://www.f2b.com.br/WSBillingAction

And now it says Protocol " http" not supported or disabled in libcurl

Any ideas on how to send this message?

1 Answer 1

2

Remove the backslash. You've added an escaped space first in the URL and a URL cannot contain a space!

A corrected line would look like:

curl -d "XML STRING" http://www.f2b.com.br/WSBillingAction

Or you store your XML in a file and you send it like

curl -d @xmlfile http://www.f2b.com.br/WSBillingAction

Sign up to request clarification or add additional context in comments.

1 Comment

HTTP Post method on server side will read the XML in string or xml class obj? I am trying it as xml class obj doesnt work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.