troubleshooting Question

Sending xml request to a webservice

Avatar of Peter Nordberg
Peter NordbergFlag for Sweden asked on
ASP.NET
6 Comments2 Solutions587 ViewsLast Modified:
Hi,

I have to do an integration from a business system to a webservice. I'm supposed to send a code in xml to the webservice at this address:

http://dev.memnonnetworks.com/ws/services/ConsignmentWS?wsdl

Then I'm supposed to get a response.

The xml I have already created like this:
        Dim path As String = "c:\memnon.xml"
        Dim writer As New XmlTextWriter(Server.MapPath("memnon.xml"), Encoding.GetEncoding(28591))
        ' start writing!
        writer.Formatting = Formatting.Indented
        'ResponseEncoding = "iso-8859-1"
        writer.WriteStartDocument()


        writer.WriteStartElement("ConsignmentList")


        For Each item As GridDataItem In RadGrid1.Items
            If item.Selected Then
                Dim id As HiddenField = DirectCast(item.FindControl("id"), HiddenField)

                Dim c As New orderDBL
                c.GetPacsoftByID(id.Value)

                Dim cTotal As New orderDBL
                cTotal.GetOrderTotal(id.Value)

                ' ---- Authentication
                writer.WriteStartElement("AuthenticationToken")
                ' ---Username
                writer.WriteStartElement("userName")
                writer.WriteString("user")
                writer.WriteEndElement() ' userName
                ' -- groupname
                writer.WriteStartElement("groupName")
                writer.WriteString("groupname")
                writer.WriteEndElement() ' end groupname
                '-- password
                writer.WriteStartElement("password")
                writer.WriteString("password")
                writer.WriteEndElement() ' end password

                writer.WriteEndElement() ' end Authentication


                '--- Consignment
                writer.WriteStartElement("Consignment")
                writer.WriteAttributeString("orderNo", c.orderID)
                writer.WriteAttributeString("templateName", "Package")

                ' --- Part
                writer.WriteStartElement("Part")
                writer.WriteAttributeString("role", "consignee")

                ' ---Address
                writer.WriteStartElement("Address")

                ' id
                writer.WriteStartElement("id")
                writer.WriteString(c.customerID)
                writer.WriteEndElement() ' end id

                ' Name
                writer.WriteStartElement("name")
                writer.WriteString(c.FirstName & " " & c.LastName)
                writer.WriteEndElement() ' --- end name

                ' adress
                writer.WriteStartElement("address")
                writer.WriteString(c.Address)
                writer.WriteEndElement() ' -- end address

                ' postcode
                writer.WriteStartElement("postcode")
                writer.WriteString(c.Zip)
                writer.WriteEndElement() ' end postcode

                ' city
                writer.WriteStartElement("city")
                writer.WriteString(c.City)
                writer.WriteEndElement() ' end city

                ' countrycode
                writer.WriteStartElement("countrycode")
                writer.WriteString(c.countryCode)
                writer.WriteEndElement() ' end countrycode

                writer.WriteEndElement() ' --- End Address

                ' -- Communication
                writer.WriteStartElement("Communication")

                ' contactperson
                'writer.WriteStartElement("contactPerson")
                'writer.WriteString("Kalle Persson")
                'writer.WriteEndElement() ' end contactperson

                ' mobile
                writer.WriteStartElement("mobile")
                writer.WriteAttributeString("notify", StrConv(c.alertID, VbStrConv.Lowercase))
                writer.WriteString(c.mobile)
                writer.WriteEndElement() ' end mobile

                writer.WriteEndElement() ' -- End communication

                writer.WriteEndElement() ' --- End part

                ' --- GoodsItem
                writer.WriteStartElement("GoodsItem")

                ' NoOfPackage
                writer.WriteStartElement("noOfPackages")
                writer.WriteString("1")
                writer.WriteEndElement() ' End noOfPackages

                ' weight
                writer.WriteStartElement("weight")
                'writer.WriteString("1")
                writer.WriteEndElement() ' end weight
                writer.WriteEndElement() ' --- End GoodsItem

                ' --- TransportProduct
                writer.WriteStartElement("TransportProduct")
                writer.WriteStartElement("PaymentInstruction")
                writer.WriteAttributeString("value", "P")
                writer.WriteEndElement() ' End paymentInstr
                writer.WriteEndElement() ' --- End Transportproduct

                writer.WriteEndElement() ' --- End consignement

            End If
        Next

        writer.WriteEndElement() ' consignmentList
        writer.WriteEndDocument()      
        writer.Close()

But I'm not sure how to send this request and then handle the response.

The manual is here!
http://www.spedpoint.com/static/specifications/ConsignmentWS(eng).pdf

If someone could just show me how to handle the request and response from the service I would be very grateful.

Peter
ASKER CERTIFIED SOLUTION
viralpala

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros