ross13
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.CreateDef ault(New System.Uri("http://Expresslink-test.parcelforce.net/ws HTTP/1.1")), HttpWebRequest)
objHTTPReq.ContentType = "text/xml; charset=""utf-8"""
objHTTPReq.Headers.Add("so apaction", "createShipment")
objHTTPReq.Method = "POST"
objHTTPReq.Credentials = New System.Net.NetworkCredenti al("test", "test")
Dim DataString As StringBuilder = New StringBuilder
'************************* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ****
Dim s As String = ""
s = My.Computer.FileSystem.Rea dAllText(" E:\CreateS hip.txt")
'************************* ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** ****
Dim Postdata() As Byte = System.Text.Encoding.Defau lt.GetByte s(s)
objHTTPReq.ContentLength = Postdata.Length
Dim tempStream As Stream = objHTTPReq.GetRequestStrea m()
tempStream.Write(Postdata, 0, Postdata.Length)
tempStream.Close()
Dim stream As Stream = objHTTPReq.GetResponse().G etResponse Stream()
Dim reader As New StreamReader(stream)
Dim response As String = String.Empty
Best regards,
Ross
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.CreateDef
objHTTPReq.ContentType = "text/xml; charset=""utf-8"""
objHTTPReq.Headers.Add("so
objHTTPReq.Method = "POST"
objHTTPReq.Credentials = New System.Net.NetworkCredenti
Dim DataString As StringBuilder = New StringBuilder
'*************************
Dim s As String = ""
s = My.Computer.FileSystem.Rea
'*************************
Dim Postdata() As Byte = System.Text.Encoding.Defau
objHTTPReq.ContentLength = Postdata.Length
Dim tempStream As Stream = objHTTPReq.GetRequestStrea
tempStream.Write(Postdata,
tempStream.Close()
Dim stream As Stream = objHTTPReq.GetResponse().G
Dim reader As New StreamReader(stream)
Dim response As String = String.Empty
Best regards,
Ross
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got this to work at last.
Regards
Ross
Regards
Ross
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.