scope=transportsession, new SessionContext instance for each request
Hello, I am trying to work out a very simple example with scope=transportsession. The purpose of this exercise is to save an attribute on the session for use when the server receives several requests from the same client. The following code returns a different SessionContext instance every time the service is called. Thus when I use session.getProperty(), null is always returned even if I have called setProperty() in a previous request. public class EchoMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver{ private static final String ATTR_KEY=CUSTOM_ATTRIBUTE; public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) throws org.apache.axis2.AxisFault{ try { SessionContext sessionContext = msgContext.getSessionContext(); String id=null; if (sessionContext!=null) { id=(String)sessionContext.getProperty(ATTR_KEY); if (id==null){ id=85; sessionContext.setProperty(ATTR_KEY, id); } } // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); Is there any other configuration that I am required to add, possibly on the client side? Is there another (better) way to save an attribute for the session? I'm using axis2-1.3 (latest release) and tomcat 5.5. This is what my service.xml looks like: serviceGroup service scope=transportsession name=Echo messageReceivers messageReceiver mep=http://www.w3.org/ns/wsdl/in-out; class=org.example.www.echo.EchoMessageReceiverInOut/ /messageReceivers parameter name=ServiceClassorg.example.www.echo.EchoSkeleton/parameter ... Thanks for your help, Kevin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: scope=transportsession, new SessionContext instance for each request
Good question. Looks like the problem was on the client side. I was using the following to setup the client: Options options = new Options(); options.setAction(command); options.setTo(new EndpointReference(endpoint)); serviceClient.setOptions(options); Adding the setMangedSession() call as follows fixes the problem. Options options = new Options(); options.setAction(command); options.setTo(new EndpointReference(endpoint)); options.setManageSession(true); serviceClient.setOptions(options); Thanks again! On Thu, Mar 20, 2008 at 12:43 PM, Deepal jayasinghe [EMAIL PROTECTED] wrote: Hi Kevin , Do you sure you send the correct cookies Thank you! -Deepal Hello, I am trying to work out a very simple example with scope=transportsession. The purpose of this exercise is to save an attribute on the session for use when the server receives several requests from the same client. The following code returns a different SessionContext instance every time the service is called. Thus when I use session.getProperty(), null is always returned even if I have called setProperty() in a previous request. public class EchoMessageReceiverInOut extends org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver{ private static final String ATTR_KEY=CUSTOM_ATTRIBUTE; public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) throws org.apache.axis2.AxisFault{ try { SessionContext sessionContext = msgContext.getSessionContext(); String id=null; if (sessionContext!=null) { id=(String)sessionContext.getProperty(ATTR_KEY); if (id==null){ id=85; sessionContext.setProperty(ATTR_KEY, id); } } // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); Is there any other configuration that I am required to add, possibly on the client side? Is there another (better) way to save an attribute for the session? I'm using axis2-1.3 (latest release) and tomcat 5.5. This is what my service.xml looks like: serviceGroup service scope=transportsession name=Echo messageReceivers messageReceiver mep=http://www.w3.org/ns/wsdl/in-out; class=org.example.www.echo.EchoMessageReceiverInOut/ /messageReceivers parameter name=ServiceClassorg.example.www.echo.EchoSkeleton/parameter ... Thanks for your help, Kevin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug? SimpleType enumeration output is incorrect.
Thanks, it is working correctly for the 1.3 release. Kevin On 8/13/07, Amila Suriarachchi [EMAIL PROTECTED] wrote: Can you please test this for Axis2 1.3 release. And run this sample code which gives me the correct out put public class TestClass extends TestCase { public void testGetResponse(){ GetResponse getResponse = new GetResponse(); getResponse.setOut(Test out); getResponse.setType(Type_T.a); try { OMElement omElement = getResponse.getOMElement(GetResponse.MY_QNAME, OMAbstractFactory.getOMFactory ()); System.out.println(OM Element == + omElement.toStringWithConsume()); } catch (ADBException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (XMLStreamException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } } ns1:GetResponse xmlns:ns1= http://localhost:8080/wsdlfile/; ns1:outTest out/ns1:out ns1:typea/ns1:type /ns1:GetResponse Amila. On 8/10/07, Kevin TierOne [EMAIL PROTECTED] wrote: 1 - If I run the wsdl through the code generator, I get the file WsdlfileSkeleton.java. 2 - I implement this method: public localhost.wsdlfile.GetResponse Get(localhost.wsdlfile.Get get0) { localhost.wsdlfile.GetResponse resp=new localhost.wsdlfile.GetResponse(); resp.setOut(get0.getIn()); resp.setType(get0.getType()); return resp; } 3 - After deploying the webservice, I send the request as shown in the original post. 4 - In the TCP monitor, I see the response shown the original post. I expect that the response should echo the same values and structure as in the request. However, in the response, the Element ns4:Type_T is incorrect. The name of the element should be type. Let me know if you need any other info. Kevin On 8/10/07, Amila Suriarachchi [EMAIL PROTECTED] wrote: Can you please describe your qestion bit? in other words How can I regenerate your issue? Amila. On 8/9/07, Kevin TierOne [EMAIL PROTECTED] wrote: Sorry, I forgot to mention that I'm using Axis2 1.2. Kevin On 8/9/07, Kevin TierOne [EMAIL PROTECTED] wrote: The XML tags in the response messsage of an enumerated element uses the simpleType name. It should use the element name. For example, using the wsdl below I get the following request and response. Look at the output ns4:Type_Tc/ns4:Type_T, this element should be ns4:typec/ns4:type REQUEST: soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:q0= http://localhost:8080/wsdlfile/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; soapenv:Body q0:Get q0:inwww/q0:in q0:typec/q0:type /q0:Get /soapenv:Body /soapenv:Envelope RESPONSE: ?xml version= 1.0 encoding=http://schemas.xmlsoap.org/soap/envelope/;? soapenv:Envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body ns4:GetResponse xmlns:ns4= http://localhost:8080/wsdlfile/ out xmlns=http://localhost:8080/wsdlfile/;www/out ns4:Type_Tc/ns4:Type_T /ns4:GetResponse /soapenv:Body /soapenv:Envelope ?xml version=1.0 encoding=UTF-8? wsdl:definitions xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:tns= http://localhost:8080/wsdlfile/ xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:xsd= http://www.w3.org/2001/XMLSchema xmlns:wsaw=http://www.w3.org/2006/02/addressing/wsdl; name=wsdlfile targetNamespace= http://localhost:8080/wsdlfile/; wsdl:types xsd:schema attributeFormDefault=qualified elementFormDefault=qualified targetNamespace= http://localhost:8080/wsdlfile/; xsd:element name=Get xsd:complexType xsd:sequence xsd:element name=in type=xsd:string / xsd:element name=type type=tns:Type_T/xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:element name=GetResponse xsd:complexType xsd:sequence xsd:element name=out type=xsd:string / xsd:element name=type type=tns:Type_T /xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:simpleType name=Type_T xsd:restriction base=xsd:string
Re: Bug? SimpleType enumeration output is incorrect.
1 - If I run the wsdl through the code generator, I get the file WsdlfileSkeleton.java. 2 - I implement this method: public localhost.wsdlfile.GetResponse Get(localhost.wsdlfile.Get get0) { localhost.wsdlfile.GetResponse resp=new localhost.wsdlfile.GetResponse(); resp.setOut(get0.getIn()); resp.setType(get0.getType()); return resp; } 3 - After deploying the webservice, I send the request as shown in the original post. 4 - In the TCP monitor, I see the response shown the original post. I expect that the response should echo the same values and structure as in the request. However, in the response, the Element ns4:Type_T is incorrect. The name of the element should be type. Let me know if you need any other info. Kevin On 8/10/07, Amila Suriarachchi [EMAIL PROTECTED] wrote: Can you please describe your qestion bit? in other words How can I regenerate your issue? Amila. On 8/9/07, Kevin TierOne [EMAIL PROTECTED] wrote: Sorry, I forgot to mention that I'm using Axis2 1.2. Kevin On 8/9/07, Kevin TierOne [EMAIL PROTECTED] wrote: The XML tags in the response messsage of an enumerated element uses the simpleType name. It should use the element name. For example, using the wsdl below I get the following request and response. Look at the output ns4:Type_Tc/ns4:Type_T, this element should be ns4:typec/ns4:type REQUEST: soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:q0= http://localhost:8080/wsdlfile/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; soapenv:Body q0:Get q0:inwww/q0:in q0:typec/q0:type /q0:Get /soapenv:Body /soapenv:Envelope RESPONSE: ?xml version=1.0 encoding=http://schemas.xmlsoap.org/soap/envelope/;? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body ns4:GetResponse xmlns:ns4= http://localhost:8080/wsdlfile/; out xmlns=http://localhost:8080/wsdlfile/;www/out ns4:Type_Tc/ns4:Type_T /ns4:GetResponse /soapenv:Body /soapenv:Envelope ?xml version=1.0 encoding=UTF-8? wsdl:definitions xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:tns=http://localhost:8080/wsdlfile/ xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:wsaw=http://www.w3.org/2006/02/addressing/wsdl; name=wsdlfile targetNamespace= http://localhost:8080/wsdlfile/; wsdl:types xsd:schema attributeFormDefault=qualified elementFormDefault=qualified targetNamespace= http://localhost:8080/wsdlfile/; xsd:element name=Get xsd:complexType xsd:sequence xsd:element name=in type=xsd:string / xsd:element name=type type=tns:Type_T/xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:element name=GetResponse xsd:complexType xsd:sequence xsd:element name=out type=xsd:string / xsd:element name=type type=tns:Type_T /xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:simpleType name=Type_T xsd:restriction base=xsd:string xsd:enumeration value=a/xsd:enumeration xsd:enumeration value=b/xsd:enumeration xsd:enumeration value=c/xsd:enumeration xsd:enumeration value=d/xsd:enumeration /xsd:restriction /xsd:simpleType /xsd:schema /wsdl:types wsdl:message name=GetRequest wsdl:part element=tns:Get name=parameters / /wsdl:message wsdl:message name=GetResponse wsdl:part element=tns:GetResponse name=parameters / /wsdl:message wsdl:portType name=wsdlfile wsdl:operation name=Get wsaw:Action=tns:GetLink wsdl:input message=tns:GetRequest / wsdl:output message=tns:GetResponse / /wsdl:operation /wsdl:portType wsdl:binding name=wsdlfileSOAP type=tns:wsdlfile soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http; / wsdl:operation name=Get soap:operation soapAction=http://localhost:8080/wsdlfile/GetLink; / wsdl:input soap:body use=literal / /wsdl:input wsdl:output soap:body use=literal / /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=wsdlfile wsdl:port binding=tns:wsdlfileSOAP
Bug? SimpleType enumeration output is incorrect.
The XML tags in the response messsage of an enumerated element uses the simpleType name. It should use the element name. For example, using the wsdl below I get the following request and response. Look at the output ns4:Type_Tc/ns4:Type_T, this element should be ns4:typec/ns4:type REQUEST: soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:q0=http://localhost:8080/wsdlfile/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body q0:Get q0:inwww/q0:in q0:typec/q0:type /q0:Get /soapenv:Body /soapenv:Envelope RESPONSE: ?xml version=1.0 encoding=http://schemas.xmlsoap.org/soap/envelope/;? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body ns4:GetResponse xmlns:ns4=http://localhost:8080/wsdlfile/; out xmlns=http://localhost:8080/wsdlfile/;www/out ns4:Type_Tc/ns4:Type_T /ns4:GetResponse /soapenv:Body /soapenv:Envelope ?xml version=1.0 encoding=UTF-8? wsdl:definitions xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:tns=http://localhost:8080/wsdlfile/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:wsaw=http://www.w3.org/2006/02/addressing/wsdl; name=wsdlfile targetNamespace=http://localhost:8080/wsdlfile/; wsdl:types xsd:schema attributeFormDefault=qualified elementFormDefault=qualified targetNamespace=http://localhost:8080/wsdlfile/; xsd:element name=Get xsd:complexType xsd:sequence xsd:element name=in type=xsd:string / xsd:element name=type type=tns:Type_T/xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:element name=GetResponse xsd:complexType xsd:sequence xsd:element name=out type=xsd:string / xsd:element name=type type=tns:Type_T /xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:simpleType name=Type_T xsd:restriction base=xsd:string xsd:enumeration value=a/xsd:enumeration xsd:enumeration value=b/xsd:enumeration xsd:enumeration value=c/xsd:enumeration xsd:enumeration value=d/xsd:enumeration /xsd:restriction /xsd:simpleType /xsd:schema /wsdl:types wsdl:message name=GetRequest wsdl:part element=tns:Get name=parameters / /wsdl:message wsdl:message name=GetResponse wsdl:part element=tns:GetResponse name=parameters / /wsdl:message wsdl:portType name=wsdlfile wsdl:operation name=Get wsaw:Action=tns:GetLink wsdl:input message=tns:GetRequest / wsdl:output message=tns:GetResponse / /wsdl:operation /wsdl:portType wsdl:binding name=wsdlfileSOAP type=tns:wsdlfile soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http; / wsdl:operation name=Get soap:operation soapAction=http://localhost:8080/wsdlfile/GetLink; / wsdl:input soap:body use=literal / /wsdl:input wsdl:output soap:body use=literal / /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=wsdlfile wsdl:port binding=tns:wsdlfileSOAP name=wsdlfileSOAP soap:address location=http://localhost:8080/wsdlfile; / /wsdl:port /wsdl:service /wsdl:definitions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug? SimpleType enumeration output is incorrect.
Sorry, I forgot to mention that I'm using Axis2 1.2. Kevin On 8/9/07, Kevin TierOne [EMAIL PROTECTED] wrote: The XML tags in the response messsage of an enumerated element uses the simpleType name. It should use the element name. For example, using the wsdl below I get the following request and response. Look at the output ns4:Type_Tc/ns4:Type_T, this element should be ns4:typec/ns4:type REQUEST: soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; xmlns:q0=http://localhost:8080/wsdlfile/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; soapenv:Body q0:Get q0:inwww/q0:in q0:typec/q0:type /q0:Get /soapenv:Body /soapenv:Envelope RESPONSE: ?xml version=1.0 encoding=http://schemas.xmlsoap.org/soap/envelope/;? soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/; soapenv:Body ns4:GetResponse xmlns:ns4=http://localhost:8080/wsdlfile/; out xmlns=http://localhost:8080/wsdlfile/;www/out ns4:Type_Tc/ns4:Type_T /ns4:GetResponse /soapenv:Body /soapenv:Envelope ?xml version=1.0 encoding=UTF-8? wsdl:definitions xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/; xmlns:tns=http://localhost:8080/wsdlfile/; xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:wsaw=http://www.w3.org/2006/02/addressing/wsdl; name=wsdlfile targetNamespace=http://localhost:8080/wsdlfile/; wsdl:types xsd:schema attributeFormDefault=qualified elementFormDefault=qualified targetNamespace=http://localhost:8080/wsdlfile/; xsd:element name=Get xsd:complexType xsd:sequence xsd:element name=in type=xsd:string / xsd:element name=type type=tns:Type_T/xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:element name=GetResponse xsd:complexType xsd:sequence xsd:element name=out type=xsd:string / xsd:element name=type type=tns:Type_T /xsd:element /xsd:sequence /xsd:complexType /xsd:element xsd:simpleType name=Type_T xsd:restriction base=xsd:string xsd:enumeration value=a/xsd:enumeration xsd:enumeration value=b/xsd:enumeration xsd:enumeration value=c/xsd:enumeration xsd:enumeration value=d/xsd:enumeration /xsd:restriction /xsd:simpleType /xsd:schema /wsdl:types wsdl:message name=GetRequest wsdl:part element=tns:Get name=parameters / /wsdl:message wsdl:message name=GetResponse wsdl:part element=tns:GetResponse name=parameters / /wsdl:message wsdl:portType name=wsdlfile wsdl:operation name=Get wsaw:Action=tns:GetLink wsdl:input message=tns:GetRequest / wsdl:output message=tns:GetResponse / /wsdl:operation /wsdl:portType wsdl:binding name=wsdlfileSOAP type=tns:wsdlfile soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http; / wsdl:operation name=Get soap:operation soapAction=http://localhost:8080/wsdlfile/GetLink; / wsdl:input soap:body use=literal / /wsdl:input wsdl:output soap:body use=literal / /wsdl:output /wsdl:operation /wsdl:binding wsdl:service name=wsdlfile wsdl:port binding=tns:wsdlfileSOAP name=wsdlfileSOAP soap:address location=http://localhost:8080/wsdlfile; / /wsdl:port /wsdl:service /wsdl:definitions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
msgContext.getSessionContext() is null
Using Axis2 1.2: In the receiverInOut.invokeBusinessLogic() code, msgContext.getSessionContext() always seems to be null. Instead, I use this to get the session context: msgContext.getTransportIn().getReceiver().getSessionContext(msgContext); Should msgContext.getSessionContext() be returning the SessionContext as well? Or is it null for a reason? Kevin
Axis2 + Rampart + WS-Security
I have a question about the capabilities of the rampart module. I would like to create a client that sends several SOAP messages to the server. The messages are currently authenticated using the UsernameToken in a PWCallback class. Is it possible to create a session identifier when processing the first SOAP message so the remaining SOAP messages are not required to authenticate? Is there any built-in function in rampart or the callback class to help me keep track of a session identifier? Or is this functionality out of the scope of rampart and WS-Security? Is this where WS-SecureConversation comes in to play? If so, then is there an Axis2 module in the works for WS-SecureConversation? Thanks, Kevin
Re: Axis2-1.2 and rampart-1.2 problems
You need to use Axis 1.2 and Rampart 1.2. Otherwise, use Axis 1.1 with rampart 1.1 Get rampart 1.2 from here: http://apache.org/dist/ws/rampart/1_2/rampart-1.2.zip On 6/21/07, Evandro_Contato [EMAIL PROTECTED] wrote: Hi Kevin The especification of rampart1.1 it requires Axis2-1.1, in test rampart1.1 and Axis2-1.2 occurs the error :( some idea? thanks Evandro Kevin TierOne wrote: Check to make sure you have the correct version of Rampart. Note that the link on this page refers to Rampart 1.1 http://ws.apache.org/axis2/modules/index.html Kevin Hi, I use axis2-1.2 and rampart-1.2 however when compiling occurs the error ERROR AxisServlet:157 - java.lang.NoSuchMethodError: org.apache.axis2.context.MessageContext.isEngaged (Ljavax/xml/namespace/QName;)Z some idea of as to decide the problem? thanks Evandro P. Contato -- View this message in context: http://www.nabble.com/Axis2-1.2-and-rampart-1.2-problems-tf3961165.html#a11242267 Sent from the Axis - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis2-1.2 and rampart-1.2 problems
Check to make sure you have the correct version of Rampart. Note that the link on this page refers to Rampart 1.1 http://ws.apache.org/axis2/modules/index.html Kevin Hi, I use axis2-1.2 and rampart-1.2 however when compiling occurs the error ERROR AxisServlet:157 - java.lang.NoSuchMethodError: org.apache.axis2.context.MessageContext.isEngaged(Ljavax/xml/namespace/QName;)Z some idea of as to decide the problem? thanks Evandro P. Contato
Invalid MessageContext assoc with In key?
I'm having an issue with the messageContexts in the PostDispatch Handlers. I would like to read some data from the original envelope from a custom handler. I'm reading the envelope by using: messageContext.getOperationContext().getMessageContext(key).getEnvelope() If my skeleton code completes without exceptions these are the envelope values of the message contexts. This is the behaviour that I expect. key = In, envelope is the original incoming message key = Out, envelope is the outgoing message key = Fault, envelope is null The problem is if my skeleton code throws an exception: key = In, envelope is the fault envelope *** WHY is it the Fault envelope? *** key = Out, envelope is null key = Fault, envelope is the fault envelope Is there an error with the message context associated with the In key? Why is the envelope of the In context overwritten? If it helps, I've narrowed the call that changes the envelope value to this: AxisServlet.java:368 msgContext.setEnvelope(faultContext.getEnvelope());