Skip to main content

Re: Fast Infoset not working, no different than SOAP

8 replies [Last post]
Anonymous

http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

It looks it should be one or the other. One would think it would be
fastinfoset. Likely lots of the documentation just is old. How do I get
this done?

# application/fastinfoset
# application/fastsoap

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pcootey

http://www.itu.int/ITU-T/asn1/xml/tutorial-fws.pdf Tutorial indicates the
following should be on the post. "application/fastsoap" is conspicuously
absent from the POST Content-Type and Accepts sections. This is why I don't
think the documented way works. Perhaps there is a new way to do this which
is not documented.

POST /AlertPort HTTP/1.1
Content-Type: application/fastsoap; action="urn:alert"
Accepts: application/fastsoap, application/text+xml
Content-Length: ....
... sequence of octets …

pcootey

<<<<<<<<<< Web Method on Service Side start >>>>>>>>>

@WebMethod(operationName = "processEpCacheSet", action =
"urn:ProcessEpCacheSet")
public String processEpCacheSet(
@WebParam(name = "id") String cacheItemId,
@WebParam(name = "data") byte[] cacheItemData)
throws EpServiceException {

String epCacheItemId = null;
try {
System.out.println("Make the call!!!");
epCacheItemId = _epCacheService.asyncSetRequest(cacheItemId,
cacheItemData);
} catch (Exception e) {
_logger.log(Level.SEVERE,
"Error calling syncGet() for cacheItemId {0}. {1}",
new Object[] { cacheItemId, e.getMessage() });

throw new WebApplicationException(e,
Response.Status.INTERNAL_SERVER_ERROR);
}
return epCacheItemId + " added to cache!";

}

<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>

pcootey

Followed Instructions
http://metro.java.net/2.2/guide/ch02.html#using-fastinfoset

Glassfish 3.1.2
jdk 1.7

Not getting Infoset in any following POST. Should require just this one
line of code, doesn't seem to work. Ideas on why this is going wrong are
welcome.

//Client Code
public EpCacheFiClient(long period) {
try {
//EpCacheService generated by Metro
against WSDL using com.sun.tools.ws.ant.WsImport
_service = new EpCacheService(new URL(WSDL_URL_KEY), QNAME);
_port = _service.getEpCachePort();

//Just as instructed in above link
Map ctxt =
((javax.xml.ws.BindingProvider)_port).getRequestContext();
ctxt.put("com.sun.xml.ws.client.ContentNegotiation", "pessimistic");

if (_port != null) {
System.out.println("Found service port!");
} else {
System.exit(128);
}

} catch (MalformedURLExcept

pcootey

Thank you everyone for your help. I ended up finding what was going on, it
was the libraries. The recommended commands and technique would have worked
if I had used the correct string. Unfortunately, the documentation does not
differentiate between internal and external libraries and uses a deprecated
enumeration.

In short if you use jax-ws embedded into JDK use this property [1];
otherwise, try [2].

[1] com.sun.xml.internal.ws.client.ContentNegotiation
[2] com.sun.xml.ws.client.ContentNegotiation

Please read the following solution on the glassfish forum where I also
posted this question.
http://home.java.net/forum/topic/glassfish/glassfish/fast-infoset-compar...

Glen Mazza

The doc you pointed to says: " If the request is received by a Fast
Infoset-enabled service, ..." meaning that even if you configure it
client-side you won't get it unless the service can do Fast Infoset.
Are you sure the service can do that?

Glen

On 09/11/2012 04:58 PM, pcootey wrote:
> Followed Instructions
> http://metro.java.net/2.2/guide/ch02.html#using-fastinfoset
>
> Glassfish 3.1.2
> jdk 1.7
>
> Not getting Infoset in any following POST. Should require just this one
> line of code, doesn't seem to work. Ideas on why this is going wrong are
> welcome.
>
> //Client Code
> public EpCacheFiClient(long period) {
> try {
> //EpCacheService generated by Metro
> against WSDL using com.sun.tools.ws.ant.WsImport
> _service = new EpCacheService(new URL(WSDL_URL_KEY), QNAME);
> _port = _service.getEpCachePort();
>
> //Just as instructed in above link
> Map ctxt =
> ((javax.xml.ws.BindingProvider)_port).getRequestContext();
> ctxt.put("com.sun.xml.ws.client.ContentNegotiation", "pessimistic");
>
> if (_port != null) {
> System.out.println("Found service port!");
> } else {
> System.exit(128);
> }
>
> } catch (MalformedURLExcept
>
>
>

mangasreekanth
Offline
Joined: 2009-05-25
Points: 0

Hi,

It works for me. I created a simple webservice using Netbeans app and a
client app to invoke the service. I tried these following cases.

1) Set the system property while running the client

-Dcom.sun.xml.ws.client.ContentNegotiation=pessimistic

2) Similar to the way the actual problem was reported.

private static String sayHello(java.lang.String name) {
simple.client.TestWebServiceService service = new
simple.client.TestWebServiceService();
simple.client.TestWebService port = service.getTestWebServicePort();
Map ctxt =
((javax.xml.ws.BindingProvider)port).getRequestContext();

ctxt.put("com.sun.xml.ws.client.ContentNegotiation", "pessimistic");
return port.sayHello(name);
}

3) In the client side policy file, use "ns1:OptimizedMimeSerialization".
This can be set using QoS to the webservice in netbeans client.

[image: Inline image 1]

All the above cases, I get this on the wire:

Can't paste the log here. So attaching screen shot.

[image: Inline image 1]

With out using FI, I get this:

Glen Mazza

Looks good--thanks for sharing.

Glen

On 09/12/2012 10:55 AM, Sreekanth wrote:
>
> Hi,
>
> It works for me. I created a simple webservice using Netbeans app and
> a client app to invoke the service. I tried these following cases.
>
> 1) Set the system property while running the client
> -Dcom.sun.xml.ws.client.ContentNegotiation=pessimistic
> 2) Similar to the way the actual problem was reported.
>
> private static String sayHello(java.lang.String name) {
> simple.client.TestWebServiceService service = new
> simple.client.TestWebServiceService();
> simple.client.TestWebService port = service.getTestWebServicePort();
> Map ctxt =
> ((javax.xml.ws.BindingProvider)port).getRequestContext();
> ctxt.put("com.sun.xml.ws.client.ContentNegotiation", "pessimistic");
> return port.sayHello(name);
> }
>
>
> 3) In the client side policy file, use
> "ns1:OptimizedMimeSerialization". This can be set using QoS to the
> webservice in netbeans client.
>
> Inline image 1
>
>
> All the above cases, I get this on the wire:
>
> Can't paste the log here. So attaching screen shot.
>
> Inline image 1
>
>
> With out using FI, I get this:
>

pcootey

Message - they all look the same, sent 50 of them. None of them seem to
indicate they should be Fast Infoset

POST /epcache/EpCacheService HTTP/1.1
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:ProcessEpCacheSet"
User-Agent: JAX-WS RI 2.2.4-b01
Host: linux-pcootey:8080
Connection: keep-alive
Content-Length: 319