Soap Request Information Needed VB.net

  • Thread starter Thread starter David Rizzo
  • Start date Start date
D

David Rizzo

Guest
We are using an API from a third party company, they want us to send the SOAP request. I asked a co-worker to help with this and we got as far as the XML but can't figure out how to get the soap request the way they want it. Here is our code so far.

Public Sub WriteToRoadNet()
Dim tws As New RoadNetWebServices.TransportationWebService With {
.Url = WebServiceURL
}

Dim Recipient As New RoadNetWebServices.ActiveAlertRecipient
With Recipient
If Me.Pkey > 0 Then .pKey = Me.Pkey Else .pKey = Nothing

If Not Me.IsEmail Then
.activeAlertMethod = RoadNetWebServices.ActiveAlertMethod.nsmText
If Me.PreDelivery Then
.minutesBeforeDelivery = 15
Else
.minutesBeforeDelivery = 0
End If
.delivered = False
.initialETA = False
.updatedETA = False
Else
.activeAlertMethod = RoadNetWebServices.ActiveAlertMethod.nsmEmail
.minutesBeforeDelivery = 0
.delivered = Me.Delivered
.initialETA = Me.InitialETA
.updatedETA = Me.UpdatedETA
End If

.recipientType = Me.RecipientType
.locationIdentity = New RoadNetWebServices.LocationIdentity
With .locationIdentity
.locationID = LocationID 'RID
.locationType = "SIT"
.regionID = "CE"
End With
.recipients = Me.Recipient
End With
Dim Recipients() As RoadNetWebServices.ActiveAlertRecipient = {Recipient}

'**********************************************************
Dim serxml As New System.Xml.Serialization.XmlSerializer(tws.SaveActiveAlertRecipients(Recipients).GetType())
Dim ms = New System.IO.MemoryStream()
serxml.Serialize(ms, tws.SaveActiveAlertRecipients(Recipients))
Dim xml As String = System.Text.Encoding.UTF8.GetString(ms.ToArray())
'**********************************************************

Try
Recipients = tws.SaveActiveAlertRecipients(Recipients)
Catch ex As Exception
Logger.Log(ex)
Environment.Exit(-1)
End Try

tws = Nothing
Recipient = Nothing
Recipients = Nothing
End Sub


The XML output - My above code produces in the variable "xml"


<?xml version="1.0"?>
<ArrayOfActiveAlertRecipient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="XML Schema">
<ActiveAlertRecipient>
<pKey xmlns="Homepage">0</pKey>
<locationIdentity xmlns="Homepage">
<regionID>CE</regionID>
<locationType>SIT</locationType>
<locationID>359862</locationID>
</locationIdentity>
<recipientType xmlns="Homepage">002</recipientType>
<activeAlertMethod xmlns="Homepage">nsmText</activeAlertMethod>
<recipients xmlns="Homepage">4842562961</recipients>
<initialETA xmlns="Homepage">false</initialETA>
<updatedETA xmlns="Homepage">false</updatedETA>
<arrived xmlns="Homepage">false</arrived>
<delivered xmlns="Homepage">false</delivered>
<missedTimeWindow xmlns="Homepage">false</missedTimeWindow>
<minutesBeforeDelivery xmlns="Homepage">0</minutesBeforeDelivery>
<isDelete xmlns="Homepage">false</isDelete>
</ActiveAlertRecipient>
</ArrayOfActiveAlertRecipient>

A sample of what the third part company wants. (Soap Styled)


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="XML Schema">
<soap:Body>
<SaveRoute xmlns="Homepage">
<route>
<routeIdentity>
<regionID>STLOUIS</regionID>
<routeDate>2014-01-31</routeDate>
<routeID>TEST</routeID>
</routeIdentity>
<description>Hazelwood</description>
<internalRouteID>863837</internalRouteID>
<assigned>true</assigned>
<outOfSequence>false</outOfSequence>
<seal/>
<plannedDistance>185.38</plannedDistance>
<projectedDistance>185.38</projectedDistance>
<actualDistance>0</actualDistance>
<plannedStart>2014-01-31T11:00:00</plannedStart>
<plannedOriginDeparture>2014-01-31T11:20:00</plannedOriginDeparture>
<plannedDestinationArrival>2014-01-31T22:08:42</plannedDestinationArrival>
<plannedComplete>2014-01-31T22:28:42</plannedComplete>
<projectedOriginDeparture>2014-01-31T11:20:00</projectedOriginDeparture>
<projectedDestinationArrival>2014-01-31T22:08:42</projectedDestinationArrival>
<projectedComplete>2014-01-31T22:28:42</projectedComplete>
<routeStartTimeQuality>dqtUnknown</routeStartTimeQuality>
<originDepartTimeQuality>dqtUnknown</originDepartTimeQuality>
<destinationArrivalTimeQuality>dqtUnknown</destinationArrivalTimeQuality>
<routeCompleteTimeQuality>dqtUnknown</routeCompleteTimeQuality>
<plannedCost>418</plannedCost>
<actualCost>0</actualCost>
<dispatcherID/>
<group/>
<scenario>DELIVERY</scenario>
<wirelessLoaded>true</wirelessLoaded>
<wirelessProvider>wpCustom</wirelessProvider>
<inProgress>false</inProgress>
<complete>false</complete>
<gpsUnitID/>
<lastInboundMessageId>0</lastInboundMessageId>
<numberOfStops>XXX</numberOfStops>
<numberOfStopsDelivered>0</numberOfStopsDelivered>
<numberOfStopsCancelled>0</numberOfStopsCancelled>
<positionText/>
<positionLatitude>XXX </positionLatitude>
<positionLongitude>XXXX</positionLongitude>
<delayMinutes>0</delayMinutes>
<delayType/>
<postDelayMinutes>0</postDelayMinutes>
<postDelayType/>
<status/>
<routeType/>
<lastStopIsDestination>false</lastStopIsDestination>
<origin>
<regionID>STLOUIS</regionID>
<locationType>DPT</locationType>
<locationID>631</locationID>
</origin>
<destination>
<regionID>STLOUIS</regionID>
<locationType>DPT</locationType>
<locationID>631</locationID>
</destination>
<originTimeZone>tmzCentralTimeUSCanada</originTimeZone>
<destinationTimeZone>tmzCentralTimeUSCanada</destinationTimeZone>
<userDefinedField1>3145024000</userDefinedField1>
<userDefinedField2/>
<userDefinedField3/>
<color>16711680</color>
<isDeliveryRoute>true</isDeliveryRoute>
<helper>rhtNonHelper</helper>
<driver1Name>XXX</driver1Name>
<driver2Name/>
<preRouteSurveyIdentity xsi:nil="true"/>
<postRouteSurveyIdentity xsi:nil="true"/>
<reportedDistance>-1</reportedDistance>
<reportedDistanceNote/>
<stops>
<stopIdentity>
<regionID>STLOUIS</regionID>
<routeDate>2014-01-31</routeDate>
<routeID>TEST</routeID>
<internalStopID>1</internalStopID>
</stopIdentity>
<stopIndex>0</stopIndex>
<plannedSequenceNum>1</plannedSequenceNum>
<actualSequenceNum>1</actualSequenceNum>
<stopType>stpStop</stopType>
<locationIdentity>
<regionID>STLOUIS</regionID>
<locationType>SIT</locationType>
<locationID>2073379-003</locationID>
</locationIdentity>
<latitude>38781094</latitude>
<longitude>-90482698</longitude>
<buildingDeliverySequence>0</buildingDeliverySequence>
<consignee/>
<shipper/>
<deliveryRadius>0.05</deliveryRadius>
<plannedArrival>2014-01-31T11:43:09</plannedArrival>
<projectedArrival>2014-01-31T11:43:09</projectedArrival>
<arrivalTimeQuality>dqtUnknown</arrivalTimeQuality>
<departureTimeQuality>dqtUnknown</departureTimeQuality>
<plannedDeparture>2014-01-31T12:04:45</plannedDeparture>
<projectedDeparture>2014-01-31T12:04:45</projectedDeparture>
<cancelled>false</cancelled>
<plannedDistance>18.23</plannedDistance>
<projectedDistance>18.23</projectedDistance>
<actualDistance>0</actualDistance>
<openTime>2014-01-31T10:00:00</openTime>
<closeTime>2014-02-01T05:00:00</closeTime>
<tw1OpenTime>2014-01-31T10:00:00</tw1OpenTime>
<tw1CloseTime>2014-01-31T12:00:00</tw1CloseTime>
<tw2OpenTime>2014-01-31T22:00:00</tw2OpenTime>
<tw2CloseTime>2014-02-01T05:00:00</tw2CloseTime>
<delayType/>
<delayMinutes>0</delayMinutes>
<seal/>
<userDefinedField1/>
<userDefinedField2/>
<userDefinedField3/>
<locationUserDefinedField1/>
<locationUserDefinedField2></locationUserDefinedField2>
<locationUserDefinedField3></locationUserDefinedField3>
<timeZone>tmzEasternTimeUSCanada</timeZone>
<instructions></instructions>
<redeliveryID>0</redeliveryID>
<cancelCode/>
<undeliverableCode/>
<undeliverable>false</undeliverable>
<additionalServiceTime>0</additionalServiceTime>
<quantities xsi:nil="true"/>
<reasonCodes xsi:nil="true"/>
<locationName></locationName>
<address>
<line1></line1>
<line2/>
<crossStreet/>
<region1>Saint Charles</region1>
<region2>SaintCharles</region2>
<region3>MO</region3>
<postalCode>633012844</postalCode>
<country>US</country>
</address>
<phoneNumber></phoneNumber>
<driver1Name></driver1Name>
<driver2Name/>
<routeComplete>false</routeComplete>
<routeInProgress>false</routeInProgress>
<plannedDeliveryCost>40</plannedDeliveryCost>
<actualDeliveryCost>0</actualDeliveryCost>
<surveyIdentity xsi:nil="true"/>
<removeFlag>false</removeFlag>
</stops>
</route>
<placementOptions>
<placementType>sptNone</placementType>
<stopIdentity xsi:nil="true"/>
</placementOptions>
<timeZoneOptions>
<embeddedInTimestamp>false</embeddedInTimestamp>
<optionType>tzoGMT</optionType>
<timeZone>tmzNone</timeZone>
</timeZoneOptions>
</SaveRoute>
</soap:Body>
</soap:Envelope>

Continue reading...
 
Back
Top