Avatar of ross13
ross13
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Create a soap envelope

Hi,

I am working on integrating with parcelforce and was given a wsdl file. When I have integrated this into my visual studio solution I am unable to see any methods for calling the required functions.

I am thinking of manually trying to create a soap as I have used a tool called SoapUI and this works very well. I am trying to test if this would work by saving the xml request in a text file and trying to post it but without much luck.

When ever I have done any web service work before I have been able to reference the service directly and it works calling the methods in the service.


I have been trying the following as I am running out of ideas. I have attached the .wsdl file if anyone has a better idea how to integrate.

   Dim objHTTPReq As HttpWebRequest
            Dim objHTTPRes As HttpWebResponse


            objHTTPReq = CType(WebRequest.CreateDefault(New System.Uri("http://Expresslink-test.parcelforce.net/ws HTTP/1.1")), HttpWebRequest)
            objHTTPReq.ContentType = "text/xml; charset=""utf-8"""
            objHTTPReq.Headers.Add("soapaction", "createShipment")
            objHTTPReq.Method = "POST"

            objHTTPReq.Credentials = New System.Net.NetworkCredential("test", "test")
            Dim DataString As StringBuilder = New StringBuilder


            '*********************************************************************************************************************************
            Dim s As String = ""
            s = My.Computer.FileSystem.ReadAllText("E:\CreateShip.txt")
           
            '*********************************************************************************************************************************
            Dim Postdata() As Byte = System.Text.Encoding.Default.GetBytes(s)
            objHTTPReq.ContentLength = Postdata.Length

            Dim tempStream As Stream = objHTTPReq.GetRequestStream()
            tempStream.Write(Postdata, 0, Postdata.Length)
            tempStream.Close()


            Dim stream As Stream = objHTTPReq.GetResponse().GetResponseStream()
            Dim reader As New StreamReader(stream)
            Dim response As String = String.Empty

Best regards,

Ross
.NET ProgrammingWeb ServicesWCFSOAP Protocol

Avatar of undefined
Last Comment
ross13

8/22/2022 - Mon
mccarl

I'm not a .NET developer but is it possible that it doesn't like the " HTTP/1.1" bit on the end of your URI. Try removing that and see how you go.

trying to post it but without much luck
Generally, it would be a good idea to explain in a bit more detail how something is failing, "without much luck" is not much to go on. Do you get an error message? Does it just return something that you aren't expecting? etc, etc.
ASKER CERTIFIED SOLUTION
Bob Learned

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ross13

ASKER
I got this to work at last.

Regards

Ross
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck