From: Yumex85 on
Hi, Im trying to build a web services client but im having 3 problems:
1) The access wizard is not working only for this web service (Menu->
Tools-> web references), for this option to appear you have to
install webservicess office 2003 plug in
2) Since wizard is not working (i´d like to know why), i tried to
write a client using the soap toolkit3.0, but when the method gets a
complex type parameter like Array, that just wont work!
3) I'll have to use this code where proxy authentication is required
to access internet, but i have no idea how to do it, httpconnector3.0
properties wont work with me


the webservice im trying to use is : https://www3.bcb.gov.br/sgspub/JSP/sgsgeral/FachadaWSSGS.wsdl


So here it is a code i wrote that actually works:
Use parameters : getValor(226,"30/04/2007")


Public Function getValor(oidSerie As Integer, dataReferencia As Date)
' variable declarations
Dim objSoap As New SoapClient30
Dim sXML As String
Dim oSerializer As New SoapSerializer30
Dim objParser As New DimeParser30
Dim oReader As SoapReader30
Dim oConnector As SoapConnector30
Dim sAno As String
Dim sMes As String
Dim sDia As String
Dim sDataReferencia As String
Const sNAMESPACE As String = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS"
Const sENDPOINT As String = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS?wsdl"

sAno = Year(dataReferencia)
sMes = Month(dataReferencia)
sDia = Day(dataReferencia)
sDataReferencia = sDia & "/" & sMes & "/" & sAno

Set oConnector = New HttpConnector30
oConnector.Property("EndPointURL") = sENDPOINT
oConnector.Property("WinHTTPAuthScheme") = 1
oConnector.Connect
oConnector.Property("SoapAction") = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS/getValor"

oConnector.BeginMessage

With oSerializer
.Init oConnector.InputStream
.StartEnvelope "soap"
.StartBody
.StartElement "getValor", sNAMESPACE
.StartElement "codigoSerie"
.WriteString CStr(oidSerie)
.EndElement
.StartElement "data"
.WriteString sDataReferencia
.EndElement
.EndElement
.EndBody
.EndEnvelope
End With

oConnector.EndMessage
Set oReader = New SoapReader30
oReader.Load oConnector.OutputStream

getValor = oReader.Body.Text

End Function

---------------------------------------------------------------------------------------------------------
Now here it is another method from this webservice that i want to use
but it won´t work coz it gets an array as a parameter: (you can use
226, "30/3/2007","15/04/2007" as arguments to test this function)


Public Function getValoresSeriesVO(oidSerie As Variant, dataReferencia
As Date, dataFim As Date)
' variable declarations

Dim objSoap As New SoapClient30
Dim sXML As String
Dim oSerializer As New SoapSerializer30
Dim objParser As New DimeParser30
Dim oReader As SoapReader30
Dim oConnector As SoapConnector30
Dim sAno As String
Dim sMes As String
Dim sDia As String
Dim sDataReferencia As String
Dim sDataFim As String
Const sNAMESPACE As String = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS"
Const sENDPOINT As String = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS?wsdl"
Dim Mapper As ISoapTypeMapper
Dim Factory As New SoapTypeMapperFactory30
Set Mapper = Factory.GetMapper(enXSDarray, Nothing)
Dim test(1) As Long
test(0) = 226
sAno = Year(dataReferencia)
sMes = Month(dataReferencia)
sDia = Day(dataReferencia)
sDataReferencia = sDia & "/" & sMes & "/" & sAno

sAno2 = Year(dataFim)
sMes2 = Month(dataFim)
sDia2 = Day(dataFim)
sDataFim = sDia2 & "/" & sMes2 & "/" & sAno2
'http://msdn2.microsoft.com/en-us/library/aa917299.aspx
Set oConnector = New HttpConnector30
oConnector.Property("EndPointURL") = sENDPOINT
'oConnector.Property("ProxyUser") = "tget220"
'oConnector.Property("ProxyPassword") = "7537smnwhM"
'oConnector.Property("ProxyServer") = "proxy_corp"
'oConnector.Property("ProxyPort") = 80
'oConnector.Property("SSLClientCertificateName")= CURRENT_USER
\LOCAL_MACHINE\store-name\cert-name
oConnector.Property("WinHTTPAuthScheme") = 1
oConnector.Connect
oConnector.Property("SoapAction") = "https://www3.bcb.gov.br/wssgs/
services/FachadaWSSGS/getValoresSeriesVO"

oConnector.BeginMessage

With oSerializer
.Init oConnector.InputStream
.StartEnvelope "soap"
.StartBody
.StartElement "getValoresSeriesVO", sNAMESPACE
.StartElement "codigosSeries"
Mapper.Write oSerializer, "http://schemas.xmlsoap.org/soap/
encoding/", enDocumentEncoded, 0, test
'.WriteString CStr(oidSerie)
.EndElement
.StartElement "dataInicio"
.WriteString sDataReferencia
.EndElement
.StartElement "dataFim"
.WriteString sDataFim
.EndElement
.EndElement
.EndBody
.EndEnvelope
End With

oConnector.EndMessage
Set oReader = New SoapReader30
oReader.Load oConnector.OutputStream

getValoresSeriesVO = oReader.Body.Text

End Function




Please help me out
Yumi

 | 
Pages: 1
Prev: Linking to paradox tables
Next: Hi