Consultor Eletrônico



Kbase P72655: Accessing a Session Managed Web Service from a 4GL client produces error 10894 and 11506
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   24/11/2009
Status: Verified

SYMPTOM(s):

Accessing a Session Managed Web Service from a 4GL client produces error 10894 and 11506

Web service operation <> generated a SOAP Fault. SOAP faultstring is: An error was detected in the Web Service request. (10894)(11506)

The ProSoapView (SoapSpy) shows error 10930 as the SOAP Fault detail

Service <>, method <> is missing the UUID header. (10930)

The Web Service proxy was not created with the Free Session Model option

The AppServer mode is not configured as state-free

FACT(s) (Environment):

OpenEdge 10.x
All Supported Operating Systems

CAUSE:

With a managed Web Service you need to manage each connection by calling a connect method. This connect method will return an object ID which you need to add to a SOAP header to be able to call any subsequent method.

FIX:

To use a session-managed Web Service you need to:

Instantiate the AppObject as appropiate for the client platform.
Connect to an AppServer by calling the connect method on the AppObject before calling any other Web Service (AppObject) method.
Obtain the AppObject ID value from the SOAP response header for the connect method and use it for all subsequent calls to methods in the session-managed AppObject.
Invoke any available methods on the AppObject, as required.
Ensure that the last method you invoke on the AppObject is the object's release method.
Also note that the AppServer operating modes that support session-managed applications include:

State-reset
State-aware
Stateless
The following is an example from an OpenEdge 4GL client:

DEFINE VARIABLE hWebService AS HANDLE.
DEFINE VARIABLE hContextManagedObj AS HANDLE.
DEFINE VARIABLE g_header AS HANDLE.
DEFINE VARIABLE cuserId AS CHARACTER.
DEFINE VARIABLE password AS CHARACTER.
DEFINE VARIABLE appServerInfo AS CHARACTER.
DEFINE VARIABLE piiPause AS INTEGER INIT 3.
DEFINE VARIABLE pocContext AS CHARACTER.
/* 1. Instantiate the AppObject as appropriate for the client platform. */
CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'http://PC1:8080/wsa/wsa1/wsdl?targetURI=ContextManaged'
-Service ContextManagedService
-Port ContextManagedObj").
RUN ContextManagedObj SET hContextManagedObj ON hWebService.
/* Associate the request & response callbacks with the port type */
hContextManagedObj:SET-CALLBACK-PROCEDURE("REQUEST-HEADER", "ReqHandler").
hContextManagedObj:SET-CALLBACK-PROCEDURE("RESPONSE-HEADER", "ResHandler").
/* 2. Connect to an AppServer by calling the connect method on the AppObject
before calling any other Web Service (AppObject) method. */
RUN Connect_ContextManaged IN hContextManagedObj(INPUT cUSERID, INPUT password, INPUT appServerInfo).
/* 4. Invoke any available methods on the AppObject, as required. */
RUN pSetContext IN hContextManagedObj(INPUT piiPause).
RUN pGetContext IN hContextManagedObj(OUTPUT pocContext).
MESSAGE "input: " piiPause " output: " pocContext VIEW-AS ALERT-BOX.
/* 5. Ensure that the last method yuu invoke on the AppObject is the
object's release method. */
RUN Release_ContextManaged IN hContextManagedObj.
DELETE OBJECT hContextManagedObj.
hWebService:DISCONNECT().
DELETE OBJECT hWebService.

/**************** Internal Procedures ****************/
/* 3a. Obtain the AppObject ID value from the SOAP response header
for the connect method ... */
PROCEDURE ResHandler:
DEF INPUT PARAMETER hHeader AS HANDLE.
DEF INPUT PARAMETER cNamespace AS CHAR.
DEF INPUT PARAMETER cLocalNS AS CHAR.
IF NOT VALID-HANDLE(g_header) THEN DO: /* first response */
g_header = hHeader.
END.
ELSE DO: /* all subsequent responses */
DELETE OBJECT hHeader.
END.
END PROCEDURE.
/* 3b. ... and use it for all subsequent calls to methods in the
&nbsp.; session-managed AppObject. */
PROCEDURE ReqHandler:
DEF OUTPUT PARAMETER hHeader AS HANDLE.
DEF INPUT PARAMETER cNamespace AS CHAR.
DEF INPUT PARAMETER cLocalNS AS CHAR.
DEF OUTPUT PARAMETER lDeleteOnDone AS LOGICAL.
IF NOT VALID-HANDLE (g_header) THEN DO: /* first request */
hHeader = ?.
END.
ELSE DO: /* subsequent requests */
hHeader = g_header.
lDeleteOnDone = FALSE.
END.
END PROCEDURE.
/************* End of Internal Procedures *************/.