Hi We are calling the webservice function from vb script by using "MSSOAP.SoapClient30", the function returns the byte array and we are saving that as *.jar file below is the sample code
============================================================
sAdminSOAPUrl = "http://testapp.com:80/test/ecs/webservices/AdminService?wsdl"
Dim vaData
Set soapClient3 = CreateObject("MSSOAP.SoapClient30")
Call soapClient3.MSSoapInit(sAdminSOAPUrl, "AdminService", "AdminService")
soapClient3.ConnectorProperty("EndPointURL") = sAdminSOAPUrl
vaData = soapClient3.exportDeployment("test","test","test_data")
If (IsArray(vaData)) Then
rgData = vaData
WScript.Echo rgData
sFilename = sPath & "xplbio.jar"
hFile = FreeFile()
Open sFilename For Binary As #hFile
Put #hFile, , rgData
Close #hFile
Dim fso As New FileSystemObject
fso.CopyFile sFilename, sPath & sExportName & ".jar"
fso.DeleteFile sFilename, True
End If
============================================================
now we are trying to use the "MSXML2.ServerXMLHTTP.6.0" instead of "MSSOAP.SoapClient30" but facing issues while writing the response into *.jar file and its being corrupt.
we have tried by channging the respose header as below but facing the same issue
"Content-Type", "text/xml; charset=utf-8",
"Content-Type" "multipart/form-data",
"Content-Type" "application/x-www-form-urlencoded",
is there any thing which I am missing please suggest, below is the sample updated code
==============================================================
' Namespaces.
Dim NS, NS_SOAP, NS_SOAPENC, NS_XSI, NS_XSD
NS_SOAP = "http://schemas.xmlsoap.org/soap/envelope/"
' Creates an XML DOM object.
Set DOM = CreateObject("MSXML2.DOMDocument.6.0")
' XML DOM objects.
Dim Envelope, Body, Operation, Param
Const URL = "http://testapp.com:80/test/ecs/webservices/AdminService?wsdl"
' Creates the main elements.
Set Envelope = DOM.createNode(1, "soap:Envelope", NS_SOAP)
DOM.appendChild Envelope
Set Body = DOM.createElement("soap:Body")
Envelope.appendChild Body
' Creates an element for the exportDeployment function.
Set Operation = DOM.createNode(1, "exportDeployment","")
Body.appendChild Operation
' Creates an element for the exportDeployment parameter
Set Param = DOM.createNode(1, "username","")
Param.Text = "test"
Operation.appendChild Param
Set Param1 = DOM.createNode(1, "password","")
Param1.Text = "test"
Operation.appendChild Param1
Set Param2 = DOM.createNode(1, "deploymentName","")
Param2.Text = "test_data"
Operation.appendChild Param2
DIM test
Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
XMLHTTP.Open "POST", URL, False
XMLHTTP.setRequestHeader "Content-Type", "multipart/form-data; User-Agent: SOAP Sdk"
XMLHTTP.setRequestHeader "SOAPAction", URL
XMLHTTP.send DOM.xml
' Loads the response to the DOM object.
DOM.LoadXML XMLHTTP.responseXML.xml
' XML DOM objects.
Dim NodeList, Element, vaData
' Searches for the exportDeploymentReturn object, which contains the value.
Set NodeList = DOM.getElementsByTagName("*")
For Each Element in NodeList
If Element.tagName = "exportDeploymentReturn" Then
vaData = Element.Text
Exit For
End If
Next
If (IsArray(vaData)) Then
rgData = vaData
WScript.Echo rgData
sFilename = sPath & "xplbio.jar"
hFile = FreeFile()
Open sFilename For Binary As #hFile
Put #hFile, , rgData
Close #hFile
Dim fso As New FileSystemObject
fso.CopyFile sFilename, sPath & sExportName & ".jar"
fso.DeleteFile sFilename, True
End If
====================================================================