1030071002
asked on
I am having problems sending xml document using soap 1.2 in vb6
I am having problems sending xml document using soap 1.2 in vb6. i AM receiving no errors
i dont know what I a, doing wrong
here is the xml file
i dont know what I a, doing wrong
'==============================================
'Written by Igor Ostrovsky (info@ostrosoft.com)
'Visual Basic 911 (http://www.ostrosoft.com/vb)
'==============================================
Option Explicit
Dim ErrDescription As String
Public filepath As String
Public xmlReader As New DOMDocument
Public ErrNumber As String
Const strURL = "http://gmgtransport.com/ws/gmgservice.asmx"
Private Sub cmd_dialog_Click()
cmdDialog.DialogTitle = "Select A XML Request File."
cmdDialog.FileName = ""
cmdDialog.InitDir = "C:\tmp\"
cmdDialog.Flags = "&H80000" ' Use the Explorer-like Open A File dialog box template. Common dialogs that use this flag do not work under Windows NT using the Windows 95 shell.
cmdDialog.Filter = "XML Files (*.XML)|*.XML"
cmdDialog.FilterIndex = 1
End Sub
Private Sub cmdRequest_Click()
Dim o As New xmlHttp
Dim s As String
Dim DocToSend As MSXML2.DOMDocument
Dim XMLManager As DOMDocument
Dim strXML As String
On Error GoTo err_handler
cmdDialog.ShowOpen
filepath = cmdDialog.FileName
'cmdDialog.CancelError = True
If Err.Number = cdlCancel Then
Exit Sub
End If
Set DocToSend = New MSXML2.DOMDocument
If Not ReadXMLDocument(filepath, DocToSend) Then
MsgBox "Cannot read " & filepath & vbCrLf & Err.Number & ", " & Err.ErrDescription, vbCritical
Exit Sub
End If
If SendRequestXML(DocToSend, strXML, strURL) Then
xml_responce.Text = strXML
Else
MsgBox "Cannot send " & DocToSend.xml & vbCrLf & Err.Number & ", " & Err.ErrDescription, vbCritical
Exit Sub
End If
Set DocToSend = Nothing
Exit Sub
err_handler:
If Err.Number <> 0 Then MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub
Private Sub Form_Load()
cmdRequest_Click
End Sub
Private Function SendRequestXML(ByRef pXMLDoc As MSXML2.DOMDocument, ByRef pcTmp As String, ByVal pstrURL As String) As Boolean
Dim SoapActionUrl As String
Dim xmlHttp As MSXML2.XMLHTTP40
On Error GoTo err_SendRequestXML
SendRequestXML = False
Set xmlHttp = New MSXML2.XMLHTTP40
SoapActionUrl = "http://tempuri.org/GetCarrierQuote"
xmlHttp.open "POST", pstrURL, True ' False - syncronous mode
'xmlHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlHttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
xmlHttp.setRequestHeader "Content-Length", CStr(Len(pXMLDoc.xml))
xmlHttp.setRequestHeader "SOAPAction", SoapActionUrl
xmlHttp.send pXMLDoc.xml
xml_request.Text = pXMLDoc.xml
pcTmp = xmlHttp.responseXML.xml
xml_responce.Text = xmlHttp.responseXML.xml
Set xmlHttp = Nothing
SendRequestXML = True
Exit Function
err_SendRequestXML:
If IsObject(xmlHttp) Then Set xmlHttp = Nothing
ErrNumber = Err.Number
ErrDescription = "Run-time ERROR in SendRequestXML. " & Err.Description
Err.Clear
End Function
Private Function ReadXMLDocument(ByVal pDocName As String, ByRef pXMLDoc As MSXML2.DOMDocument) As Boolean
On Error GoTo err_ReadXMLDocument
ReadXMLDocument = False
pXMLDoc.async = False
pXMLDoc.resolveExternals = False ' otherwise you must have a refered DTD
pXMLDoc.validateOnParse = False ' in a same directory
pXMLDoc.Load pDocName
If pXMLDoc.parseError.errorCode = 0 Then
ReadXMLDocument = True
Else
ErrNumber = pXMLDoc.parseError.errorCode
ErrDescription = "Errors in " & pXMLDoc.parseError.url & ", line " & pXMLDoc.parseError.Line & ", pos " & pXMLDoc.parseError.linepos
ErrDescription = Err.ErrDescription & ". Error #" & Err.Number & ". " & pXMLDoc.parseError.reason
End If
Exit Function
err_ReadXMLDocument:
ErrNumber = Err.Number
ErrDescription = "Run-time ERROR in ReadXMLDocument " & Err.Description & " for " & pDocName
Err.Clear
End Function
here is the xml file
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetCarrierQuote xmlns="http://tempuri.org/">
<userName>peaches</userName>
<password>salons</password>
<carrierId>ODFL</carrierId>
<customerId>PEACSALOH4C3C5_MOROCCANOILPH4</customerId>
<sourceZip>07032</sourceZip>
<sourceState>NJ</sourceState>
<destinationZip>19006</destinationZip>
<destinationState>PA</destinationState>
<shipDate>2012-08-30</shipDate>
<items>
<QuoteLineItem>
<Quantity>12</Quantity>
<Unit>SKD</Unit>
<Class>70.0</Class>
<Weight>3000</Weight>
</QuoteLineItem>
<QuoteLineItem>
<Quantity>2</Quantity>
<Unit>SKD</Unit>
<Class>50.0</Class>
<Weight>200</Weight>
</QuoteLineItem>
</items>
<accessorials>
</accessorials>
</GetCarrierQuote>
</soap12:Body>
</soap12:Envelope>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes I have done that. everything is working the send works but I dont get any responce
I am also using soap 1.2
I am also using soap 1.2
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
POST /ws/gmgservice.asmx HTTP/1.1
Host: gmgtransport.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length