Newsgroup: it.comp.java
Titolo: Client SOAP

Allora:
ha dei file .wsdl dai quali ho ottenuto una serie di classi utilizzando il
tool WSDL2JAVA.
Ora vorrei utilizzarle facendo accesso, come client, al server.
Ho anche questo stralcio di codice VB:
Imports System.Web.Services.Protocols
Imports soa.commons.error.v3
Imports soa.commons
Public Class COBProxy
    Private COBSessionID As String
    Private strUserID As String
    Private strPassword As String
    Private strCOBUserID As String
    Private strCOBPassword As String
    Private strURL As String
    Private intCurPage As Integer
    Public PreviousInput As String
    Public PreviousOutput As String
    Public Enum ItmzStatus
        OK
        NOK
        Archived
    End Enum
    Public Sub New(ByVal UserID As String, _
                    ByVal Password As String, _
                    ByVal COBUserID As String, _
                    ByVal COBPassword As String, _
                    ByVal URL As String, _
                    ByVal TestMode As Boolean)
        PreviousInput = ""
        PreviousOutput = ""
        If TestMode Then Exit Sub
        Dim myCOBRequest As New COBLogon.RequestDataUserLogonType
        Dim myWSRequest As New COBLogon.RequestDataInvokeService
        Dim myWSResponse As COBLogon.ResponseDataInvokeService
        Dim myCOBReply As COBLogon.ResponseDataUserLogonType
        Dim myVSSContext As New COBLogon.VSSContext
        Dim myConsumerContext As New COBLogon.ConsumerContext
        Dim myUserContext As New COBLogon.UserContext
        Dim myLoggingContext As New COBLogon.LoggingContext
        strUserID = UserID
        strPassword = Password
        strCOBUserID = COBUserID
        strCOBPassword = COBPassword
        strURL = URL
        Dim myCOB As New COBLogonSecuredProxy(UserID, Password)
        myCOB.Url = strURL
        COBSessionID = ""
        myUserContext.enduserId = strCOBUserID ' "ID992602" '
        myUserContext.enduserLanguage =
COBLogon.UserContextEnduserLanguage.FR
        myConsumerContext.applicationId = "IVR"
        myConsumerContext.detailsInfo = "Test for simulation"
        myLoggingContext.correlationId = "123456789"
        myVSSContext.ConsumerContext = myConsumerContext
        myVSSContext.UserContext = myUserContext
        myVSSContext.LoggingContext = myLoggingContext
        myVSSContext.version = ""
        myWSRequest.VSSContext = myVSSContext
        myCOBRequest.clientId = 21
        myCOBRequest.password = "jkj7um"
        myCOBRequest.language = "EN"
        myCOBRequest.user = strCOBUserID
        myCOBRequest.userPassword = strCOBPassword
        myCOBRequest.passwordCheck = "Y"
        myWSRequest.Item = myCOBRequest
        myCOB.RequestEncoding = System.Text.Encoding.UTF8
        myCOB.Timeout = 1800000
        myCOB.ConnectionGroupName = strUserID
        myCOB.Proxy = System.Net.WebProxy.GetDefaultProxy()
        myCOB.Proxy.Credentials =
System.Net.CredentialCache.DefaultCredentials
        Try
            myWSResponse = myCOB.InvokeService(myWSRequest)
            myCOBReply = myWSResponse.Item
            COBSessionID = myCOBReply.correlationID
        Catch errSoapException As SoapException
            Dim mySOAError As StandardError =
ErrorManager.GetStandardError(errSoapException)
            MessageBox.Show("Error calling COB Logon" & vbCrLf &
ErrorManager.GetErrorDescription(errSoapException), "SoapException",
MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
Va tutto bene fino a quando arrivo a questo punto del codice:
myCOB.RequestEncoding = System.Text.Encoding.UTF8
myCOB.Timeout = 1800000
myCOB.ConnectionGroupName = strUserID
Credo che dovrei accedere al server tramite un proxy, ma come faccio a
fare la chiamata in JAVA?
Il Tool WSDL2JAVA mi ha generato i seguenti file:
C:\DOCUMENTS AND SETTINGS\DIEGO\MY DOCUMENTS\BELGACOM II\WSDL\BGC
+---gateway
|   \---csl
|       +---bill
|       |   \---v1
|       |           InvokeServicePortType.java
|       |           RequestDataInvokeService.java
|       |           ResponseDataInvokeService.java
|       |           ServiceRouter.java
|       |           ServiceRouterBindingStub.java
|       |           ServiceRouterLocator.java
|       |           
|       +---complaint
|       |   \---v1
|       |           InvokeServicePortType.java
|       |           RequestDataInvokeService.java
|       |           ResponseDataInvokeService.java
|       |           ServiceRouter.java
|       |           ServiceRouterBindingStub.java
|       |           ServiceRouterLocator.java
|       |           
|       +---customer
|       |   \---v1
|       |           InvokeServicePortType.java
|       |           RequestDataInvokeService.java
|       |           ResponseDataInvokeService.java
|       |           ServiceRouter.java
|       |           ServiceRouterBindingStub.java
|       |           ServiceRouterLocator.java
|       |           
|       +---employee
|       |   \---v1
|       |           InvokeServicePortType.java
|       |           RequestDataInvokeService.java
|       |           ResponseDataInvokeService.java
|       |           ServiceRouter.java
|       |           ServiceRouterBindingStub.java
|       |           ServiceRouterLocator.java
|       |           
|       \---transaction
|           \---v1
|                   InvokeServicePortType.java
|                   RequestDataInvokeService.java
|                   ResponseDataInvokeService.java
|                   ServiceRouter.java
|                   ServiceRouterBindingStub.java
|                   ServiceRouterLocator.java
|                   
+---objects
|   \---vss
|       +---consumercontext
|       |   \---v3
|       |           ConsumerContext.java
|       |           
|       +---context
|       |   \---v3
|       |           VSSContext.java
|       |           
|       +---loggingcontext
|       |   \---v3
|       |           LoggingContext.java
|       |           
|       +---providercontext
|       |   \---v3
|       |           ProviderContext.java
|       |           
|       +---servicecontext
|       |   \---v3
|       |           ServiceContext.java
|       |           TargetServiceVersion.java
|       |           
|       +---standarderror
|       |   \---v3
|       |           Category.java
|       |           Environment.java
|       |           Severity.java
|       |           StandardError.java
|       |           
|       \---usercontext
|           \---v3
|                   EnduserLanguage.java
|                   UserContext.java
|                   
\---services
    \---csl
        +---bill
        |   \---v1
        |           RequestDataGetItemizationsType.java
        |           RequestDataPrintBillType.java
        |           ResponseDataGetItemizationsType.java
        |           ResponseDataPrintBillType.java
        |           
        +---complaint
        |   \---v1
        |           BillInfoType.java
        |           RequestDataCreateComplaintType.java
        |           RequestDataValidateType.java
        |           ResponseDataValidateType.java
        |           
        +---customer
        |   \---v1
        |           DocumentsHeaderType.java
        |           DocumentsRepeatedType.java
        |           RequestDataDearchiveBillDataType.java
        |           RequestDataDearchivePrintDataType.java
        |           RequestDataGetDocumentsType.java
        |           ResponseDataGetDocumentsType.java
        |           
        +---employee
        |   \---v1
        |           RequestDataUserLogonType.java
        |           RequestDataUserLogoutType.java
        |           ResponseDataUserLogonType.java
        |           ResponseDataUserLogoutType.java
        |           
        \---transaction
            \---v1
                    RequestDataGetCustomerTransactionsType.java
                    ResponseDataGetCustomerTransactionsType.java
                    TransactionHeaderType.java
                    TransactionRepeatedType.java
Grazie infinite per l'aiuto.
Diego
-- 
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it

io non posso aiutarti
sono rimasto al basic 4
mi puoi spiegare una cosa ?
    Public Sub New(ByVal UserID As String, _
                    ByVal Password As String, _
                    ByVal COBUserID As String, _
                    ByVal COBPassword As String, _
                    ByVal URL As String, _
                    ByVal TestMode As Boolean)
è possibile utilizzare la parola New senza entrare in conflitto
con il compilatore vb ?

 con il compilatore vb ?
Non l'ho scritto io quel codice, ma probabilmente si.
Vi posto un po' di codice java che ho scritto, forse può esservi utile per
darmi una mano:
Dopo aver caricato le vari classi Java generate con WSDL2JAVA vado a fare:
myWSRequest.setRequestDataUserLogon(myCOBRequest); // carico l'oggetto per
fare la richiesta
 
 
		System.getProperties().put("proxySet","true");
		System.getProperties().put("proxyHost","
BGC-CABKHHUX857.BGC.NET
");
		System.getProperties().put("proxyPort","85");
		Call cal;
		URL url1;
 
		try
		{
 
			cal=new Call();
			String url="
http://xx.xx.xx.xxx:9080/SSG/services/ServiceRouterPort
";
			url1 = new URL(url);	
 
 
			cal.setTargetObjectURI(url);
			cal.setMethodName("InvokeService");
			Vector params = new Vector();
 
			params.addElement(myWSRequest);
			cal.setParams(params);
 
			ResponseDataInvokeService myWSResponse;
 
			Response resp;
			resp = cal.invoke(url1,"");
 
 
		}
		catch (Exception e)
		{
			String msg;
			msg = e.getMessage();
			System.out.println(msg);
		}
Ricevo un'eccezione sulla resp = cal.invoke(...) una cast exception.
Dove sbaglio?
Grazie
