Making a soap request

2,260 views
Skip to first unread message

Bjørn Høj Jakobsen

unread,
Dec 20, 2013, 11:57:11 AM12/20/13
to golan...@googlegroups.com
Hi

I am new to golang and would like make a soap request. I have created the soap envelope using SoapUi.

I have looked at some earlier posts but I did not find what I need.

So I need "something" so I can make the request.

Anybody?

Kindly regards

Bjørn

Henrik Johansson

unread,
Dec 20, 2013, 12:13:15 PM12/20/13
to Bjørn Høj Jakobsen, golang-nuts

Just use httppost in the net/httppackage. If you are unsure of the headers just look in soapui's raw tab.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bjørn Høj Jakobsen

unread,
Dec 20, 2013, 12:24:41 PM12/20/13
to golan...@googlegroups.com
So the envelope is:

   <soapenv:Header/>
   <soapenv:Body>
      <ser:getFleetStateByGroup>
         <userName>?</userName>
         <password>?</password>
         <groupName>?</groupName>
      </ser:getFleetStateByGroup>
   </soapenv:Body>
</soapenv:Envelope>

And the raw tab:

Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 387
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

I would be very great full if you could give me an idea?

Thanks

Henrik Johansson

unread,
Dec 20, 2013, 12:44:31 PM12/20/13
to Bjørn Høj Jakobsen, golang-nuts
A rough thing could be something like this but you probably have to change things for production stuff.


/ Henrik



--

Bjørn Høj Jakobsen

unread,
Dec 21, 2013, 1:09:24 AM12/21/13
to golan...@googlegroups.com, Bjørn Høj Jakobsen
Hi

I used that - but I keep getting a:
 

<faultstring>no SOAPAction header!</faultstring>


Regards


Bjørn

Tamás Gulácsi

unread,
Dec 21, 2013, 1:58:00 AM12/21/13
to golan...@googlegroups.com
That broken SOAP (I mean the spec, not your server) thing needs SoapAction header set to the called function's name.
Thus set it on request.

Bjørn Høj Jakobsen

unread,
Dec 21, 2013, 2:02:44 AM12/21/13
to golan...@googlegroups.com
HI

Do you have any example of how to do that  (try and look at the earlier post with the SoapUI stuff)

I have tried and tried - but seems that I am stuck..

Regards

Bjørn

Henrik Johansson

unread,
Dec 21, 2013, 6:18:47 AM12/21/13
to Bjørn Høj Jakobsen, golang-nuts
Something like this perhaps?
You have to create a request and set the needed headers like Tamas said.


/ Henrik



--

Bjørn Høj Jakobsen

unread,
Dec 21, 2013, 6:29:25 AM12/21/13
to golan...@googlegroups.com, Bjørn Høj Jakobsen
Thank you guys - soo much - really helped.

Now it works like a charm.

Now I will continue to get the data into postgresql.

Happy Christmas.

Regards

Bjørn
Reply all
Reply to author
Forward
0 new messages