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
ross13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
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.
0
Bob LearnedCommented:
If you have a WSDL, then I would think that you are working with a web service.  If so, you should be able to add a web reference, and call methods on the proxy class that is generated.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ross13Author Commented:
I got this to work at last.

Regards

Ross
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.