otrzymałem od Głównego Urzedu Statystycznego pliki, dzięki którym mam dostęp do bazy zarejestrowanych firm. Mogę pobierać dane po NIPie itd.
Dostałem również informacje jak używać dostarczone pliki. O ile mając doświadczenie w C# wiem że można zaimportować service references w Visual Studio, o tyle nie jestem pewien jak używać tego w PHP. Projektuję webaplikacje w Laravelu 5. Czy jest możliwość używania metod dostępnych w plikach xsd tak jak przy Visual Studio?
Przedstawiam przykładowy kod (który otrzymałęm od GUSu), wycięte adresy dla bezpieczeństwa wszystkie poufne dane zastąpione "xXx". Niestety VB.net
Kod
Przykład 1 – VB.NET
Sub PolaczBIRpubl()
'Create the binding.
Dim myBinding = New WSHttpBinding
myBinding.Security.Mode = SecurityMode.Transport
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
myBinding.MessageEncoding = WSMessageEncoding.Mtom
Dim ea As New EndpointAddress("xXxEndpointAdressxXx") 'test
Dim cc As New UslugaBIRpubl.UslugaBIRzewnPublClient(myBinding, ea)
cc.Open()
'ZALOGUJ (bez sida)
Dim strSID As String = cc.Zaloguj("xXxKLUCZxXx")
txtResult.Text &= "### Zaloguj:" & vbCrLf & strSID & vbCrLf & vbCrLf
Using (New OperationContextScope(cc.InnerChannel))
Dim requestMessage As Channels.HttpRequestMessageProperty = New Channels.HttpRequestMessageProperty
requestMessage.Headers("sid") = strSID
OperationContext.Current.OutgoingMessageProperties(Channels.HttpRequestMessageProperty.Name) = requestMessage
'POBIERZ CAPTCHA
Dim strCaptchaBASE644 As String = cc.PobierzCaptcha
pctCaptcha.Image = ImageHelper.ImageFromBase64String(strCaptchaBASE644)
'SPRAWDŹ CAPTCHA
txtResult.Text &= "### SprawdzCaptcha:" & vbCrLf & cc.SprawdzCaptcha("aaaaa").ToString & vbCrLf & vbCrLf
'DANE SZUKAJ 1
Dim objParametryGR1 As New UslugaBIRpubl.ParametryWyszukiwania
objParametryGR1.Nip = "xXxNIPxXx"
txtResult.Text &= "### DaneSzukaj (grupa 1):" & vbCrLf & cc.DaneSzukaj(objParametryGR1) & vbCrLf & vbCrLf
''DANE POBIERZ PEŁNY RAPORT
txtResult.Text &= "### DanePobierzPelnyRaport:" & vbCrLf & cc.DanePobierzPelnyRaport("xXxNumerKlientaxXx", "PublDaneRaportPrawna", "") & vbCrLf & vbCrLf
'WYLOGUJ
txtResult.Text &= "### Wyloguj:" & vbCrLf & cc.Wyloguj(strSID) & vbCrLf & vbCrLf
'GET VALUE
txtResult.Text &= "### GetValue(KomunikatKod):" & vbCrLf & cc.GetValue("KomunikatKod") & vbCrLf
txtResult.Text &= "### GetValue(KomunikatTresc):" & vbCrLf & cc.GetValue("KomunikatTresc") & vbCrLf
txtResult.Text &= "### GetValue(StatusSesji):" & vbCrLf & cc.GetValue("StatusSesji") & vbCrLf
End Using
cc.Close()
End Sub
Sub PolaczBIRpubl()
'Create the binding.
Dim myBinding = New WSHttpBinding
myBinding.Security.Mode = SecurityMode.Transport
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
myBinding.MessageEncoding = WSMessageEncoding.Mtom
Dim ea As New EndpointAddress("xXxEndpointAdressxXx") 'test
Dim cc As New UslugaBIRpubl.UslugaBIRzewnPublClient(myBinding, ea)
cc.Open()
'ZALOGUJ (bez sida)
Dim strSID As String = cc.Zaloguj("xXxKLUCZxXx")
txtResult.Text &= "### Zaloguj:" & vbCrLf & strSID & vbCrLf & vbCrLf
Using (New OperationContextScope(cc.InnerChannel))
Dim requestMessage As Channels.HttpRequestMessageProperty = New Channels.HttpRequestMessageProperty
requestMessage.Headers("sid") = strSID
OperationContext.Current.OutgoingMessageProperties(Channels.HttpRequestMessageProperty.Name) = requestMessage
'POBIERZ CAPTCHA
Dim strCaptchaBASE644 As String = cc.PobierzCaptcha
pctCaptcha.Image = ImageHelper.ImageFromBase64String(strCaptchaBASE644)
'SPRAWDŹ CAPTCHA
txtResult.Text &= "### SprawdzCaptcha:" & vbCrLf & cc.SprawdzCaptcha("aaaaa").ToString & vbCrLf & vbCrLf
'DANE SZUKAJ 1
Dim objParametryGR1 As New UslugaBIRpubl.ParametryWyszukiwania
objParametryGR1.Nip = "xXxNIPxXx"
txtResult.Text &= "### DaneSzukaj (grupa 1):" & vbCrLf & cc.DaneSzukaj(objParametryGR1) & vbCrLf & vbCrLf
''DANE POBIERZ PEŁNY RAPORT
txtResult.Text &= "### DanePobierzPelnyRaport:" & vbCrLf & cc.DanePobierzPelnyRaport("xXxNumerKlientaxXx", "PublDaneRaportPrawna", "") & vbCrLf & vbCrLf
'WYLOGUJ
txtResult.Text &= "### Wyloguj:" & vbCrLf & cc.Wyloguj(strSID) & vbCrLf & vbCrLf
'GET VALUE
txtResult.Text &= "### GetValue(KomunikatKod):" & vbCrLf & cc.GetValue("KomunikatKod") & vbCrLf
txtResult.Text &= "### GetValue(KomunikatTresc):" & vbCrLf & cc.GetValue("KomunikatTresc") & vbCrLf
txtResult.Text &= "### GetValue(StatusSesji):" & vbCrLf & cc.GetValue("StatusSesji") & vbCrLf
End Using
cc.Close()
End Sub