13 Replies Latest reply on Apr 10, 2008 3:13 AM by thomas.diesler

    http://org.jboss.ws/http#chunksize

    ratoo

      Hello!
      I'm trying to send a SOAP message through the JAAS.
      The problem is that the service is the CGI and doesn't accept "Transfer-Encoding" header.

      JBoss Remoting has a configuration for it (chunkedLength=0 ???), but how can I do it from JBossWS?

      Setting the property
      "http://org.jboss.ws/http#chunksize"
      in "standard-jaxws-client-config.xml" file
      to 0 does nothing.

      I desperately need it (it works with SUN JAAS implementation).

      Thank you.

        • 1. Re: http://org.jboss.ws/http#chunksize
          heiko.braun

          What JBossWS version is it?
          I just noticed there is bug in that piece of code, but it only affects setting the chunksize value, not removing it:

          // chunksize settings
           String chunkSizeValue = epmdProps.getProperty(EndpointProperty.CHUNKED_ENCODING_SIZE);
           int chunkSize = chunkSizeValue != null ? Integer.valueOf(chunkSizeValue) : -1;
           if (chunkSize > 0)
           {
           clientConfig.put(EndpointProperty.CHUNKED_ENCODING_SIZE, chunkSizeValue);
           }
           else
           {
           clientConfig.remove("chunkedLength");
           }
          


          • 2. Re: http://org.jboss.ws/http#chunksize
            heiko.braun

            Which basically means remove the feature, disable the chunked encoding.
            But you know what? There is a default config for that:

            HTTP 1.0 Client


            Did you try that one?

            • 3. Re: http://org.jboss.ws/http#chunksize
              ratoo

              You are right, the client is CGI, so http/1.0, but I just don't understand

              "heiko.braun@jboss.com" wrote:

              HTTP 1.0 Client
              Did you try that one?


              Where is it? How can I configure it?

              I use jboss 4.2.2 and jbossws-native-2.0.2.GA (build=200711261155)

              the call itself is a simple
              SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
              SOAPConnection conn = scf.createConnection();
              SOAPMessage response = conn.call(msg, endpoint);
              


              I looked into the remoting code (HTTPClientInvoker) where setChunkedStreamingMode is called only when chunkedValue is set, so I thought that if it's 0 there is no chunking.

              So basically I will be happy to configure JBossWS (JAAS) not to use chunking.

              Thank you very much.


              • 4. Re: http://org.jboss.ws/http#chunksize
                centecbertl

                 

                "Ratoo" wrote:

                "heiko.braun@jboss.com" wrote:

                HTTP 1.0 Client
                Did you try that one?


                Where is it? How can I configure it?

                You can use the tomcat Connector configuration to achieve this. Example given for jboss 4.0.5 restricts .net 2.0 clients to use HTTP 1.0:

                $ diff -U 5 server.xml~ server.xml
                --- server.xml~ 2006-12-06 16:03:28.403259700 +0100
                +++ server.xml 2006-12-16 10:18:38.265625000 +0100
                @@ -11,16 +11,18 @@
                 <!-- A HTTP/1.1 Connector on port 8080 -->
                 <Connector port="8080" address="${jboss.bind.address}"
                 maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
                 emptySessionPath="true"
                 enableLookups="false" redirectPort="8443" acceptCount="100"
                - connectionTimeout="20000" disableUploadTimeout="true"/>
                + connectionTimeout="20000" disableUploadTimeout="true"
                + restrictedUserAgents="^.*MS Web Services Client Protocol.*$"/>
                
                 <!-- Add this option to the connector to avoid problems with
                 .NET clients that don't implement HTTP/1.1 correctly
                 restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
                 -->
                +
                
                 <!-- A AJP 1.3 Connector on port 8009 -->
                 <Connector port="8009" address="${jboss.bind.address}"
                 emptySessionPath="true" enableLookups="false" redirectPort="8443"
                 protocol="AJP/1.3"/>
                @@ -29,11 +31,12 @@
                 <Connector port="8443" address="${jboss.bind.address}"
                 maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
                 emptySessionPath="true"
                 scheme="https" secure="true" clientAuth="false"
                 keystoreFile="${jboss.server.home.dir}/conf/centec.keystore"
                - keystorePass="centec" sslProtocol = "TLS" />
                + keystorePass="centec" sslProtocol = "TLS"
                + restrictedUserAgents="^.*MS Web Services Client Protocol.*$"/>
                 <!-- -->
                
                 <Engine name="jboss.web" defaultHost="localhost">
                
                 <!-- The JAAS based authentication and authorization realm implementation
                


                • 5. Re: http://org.jboss.ws/http#chunksize
                  ratoo

                   

                  "centecbertl" wrote:

                  You can use the tomcat Connector configuration to achieve this. Example given for jboss 4.0.5 restricts .net 2.0 clients to use HTTP 1.0:


                  Maybe I do not understand something, but I am THE client here.
                  What you suggest is to disable chunking in RESPONSE to the buggy client (like MS one).

                  In my case I'm using a JAAS to send a message to the buggy server so I have to disable chunking somehow.

                  Maybe I'm wrong with the forum and should post it to JBoss Remoting instead?

                  Ratoo


                  • 6. Re: http://org.jboss.ws/http#chunksize

                    I too am in the same boat. I am constructing a SOAPMessage object from an XML string. The service I am posting the message to is choking on the chunked request data. I want to be able to disable this and the way seems to be by using the 'HTTP 1.0 Client' config from the standard-jaxws-client-config file. I just don't know how to get my message to use this different config. I am creating and sending my SOAPMessage as follows:

                    SOAPMessageFactory messageFactory = MessageFactory.newInstance();
                    SOAPConnectionFactory connFact = SOAPConnectionFactory.newInstance();
                    SOAPMessage message = messageFactory.createMessage(
                     null, new ByteArrayInputStream(xmlString.getBytes()));
                    SOAPConnection conn = connFact.createConnection();
                    URL url = new URL(FARELOGIX_URL);
                    SOAPMessage response = conn.call(message, url);


                    What can I do differently here to get the message to use the 'HTTP 1.0 Client' config?

                    • 7. Re: http://org.jboss.ws/http#chunksize
                      ratoo

                       

                      What can I do differently here to get the message to use the 'HTTP 1.0 Client' config?


                      I think nothing. I think JBossWS (JAAS) should propagate this property to JBoss Remoting (HTTPClientInvoker), so once I remove "chunked" from the config:

                       <client-config>
                       <config-name>Standard Client</config-name>
                       <feature>http://org.jboss.ws/dispatch/validate</feature>
                       <property>
                       <property-name>http://org.jboss.ws/http#chunksize</property-name>
                       <property-value>2048</property-value>
                       </property>
                       </client-config>
                      


                      it MUST take it into account...


                      • 8. Re: http://org.jboss.ws/http#chunksize

                        Yes but they have another config in there specifically for HTTP 1.0, so it leads me to believe you can use it. I'm just wondering if they didn't set it up so use it for a low level SOAPMessage example like I am doing.

                        • 9. Re: http://org.jboss.ws/http#chunksize
                          ratoo

                          Unfortunately, the message call that failed to me is from an API which is supposed to be used from standard JDK6, so I can not modify anything in it :-(

                          • 10. Re: http://org.jboss.ws/http#chunksize

                            I can see the problematic code in RemotingConnectionImpl createRemotingMetaData:

                            populateHeaders(reqMessage, metadata);
                             clientConfig.put("chunkedLength", "1024");
                             if(msgContext != null)
                             {
                             Properties epmdProps = msgContext.getEndpointMetaData().getProperties();
                             String chunkSizeValue = epmdProps.getProperty("http://org.jboss.ws/http#chunksize");
                             int chunkSize = chunkSizeValue == null ? -1 : Integer.valueOf(chunkSizeValue).intValue();
                             if(chunkSize > 0)
                             {
                             clientConfig.put("http://org.jboss.ws/http#chunksize", chunkSizeValue);
                             } else
                             {
                             clientConfig.remove("chunkedLength");
                             }
                             }


                            It automatically puts the chunkedLength property in place any only removes it if there is a MessageContext (non null) and that MessageContext does not have the EndPointMetaData property for chunking. The only problem is that if I'm just doing a simple SOAPMessage with a URL endpoint, I don't have a MessageContext and this code gets skipped. Heiko, any thoughts?

                            • 11. Re: http://org.jboss.ws/http#chunksize
                              ratoo

                              Just to keep this topic alive...

                              Is there the possibility to fix it or should I use Metro stack instead?

                              Thanx

                              • 12. Re: http://org.jboss.ws/http#chunksize
                                talekar

                                Make sure you have META-INF/standard-jaxws-client-config.xml in the class path:

                                <?xml version="1.0" encoding="UTF-8"?>
                                
                                <!-- $Id: standard-jaxws-client-config.xml 5034 2007-11-12 14:08:23Z alessio.soldano@jboss.com $ -->
                                
                                <jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
                                 xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
                                
                                 <client-config>
                                 <config-name>Standard Client</config-name>
                                 <feature>http://org.jboss.ws/dispatch/validate</feature>
                                 <property>
                                 <property-name>http://org.jboss.ws/http#chunksize</property-name>
                                 <property-value>0</property-value>
                                 </property>
                                 </client-config>
                                
                                 <client-config>
                                 <config-name>HTTP 1.0 Client</config-name>
                                 <feature>http://org.jboss.ws/dispatch/validate</feature>
                                 </client-config>
                                
                                 <client-config>
                                 <config-name>Standard WSAddressing Client</config-name>
                                 <post-handler-chains>
                                 <javaee:handler-chain>
                                 <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
                                 <javaee:handler>
                                 <javaee:handler-name>WSAddressing Handler</javaee:handler-name>
                                 <javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler</javaee:handler-class>
                                 </javaee:handler>
                                 </javaee:handler-chain>
                                 </post-handler-chains>
                                 </client-config>
                                
                                 <client-config>
                                 <config-name>Standard SOAP 1.2 WSAddressing Client</config-name>
                                 <post-handler-chains>
                                 <javaee:handler-chain>
                                 <javaee:protocol-bindings>##SOAP12_HTTP</javaee:protocol-bindings>
                                 <javaee:handler>
                                 <javaee:handler-name>WSAddressing Handler</javaee:handler-name>
                                 <javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler</javaee:handler-class>
                                 </javaee:handler>
                                 </javaee:handler-chain>
                                 </post-handler-chains>
                                 </client-config>
                                
                                 <client-config>
                                 <config-name>Standard WSSecurity Client</config-name>
                                 <post-handler-chains>
                                 <javaee:handler-chain>
                                 <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
                                 <javaee:handler>
                                 <javaee:handler-name>WSSecurityHandlerOutbound</javaee:handler-name>
                                 <javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient</javaee:handler-class>
                                 </javaee:handler>
                                 </javaee:handler-chain>
                                 </post-handler-chains>
                                 </client-config>
                                
                                </jaxws-config>
                                



                                private static void moo() throws Exception {
                                 MessageFactory factory = MessageFactory.newInstance();
                                 SOAPMessage request = factory.createMessage();
                                 MimeHeaders mimeHeaders = request.getMimeHeaders();
                                 mimeHeaders.addHeader("SOAPAction", "YOU SOAP ACTION");
                                
                                 String text = "YOUR PAYLOAD";
                                
                                 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                                 dbf.setNamespaceAware(true);
                                 DocumentBuilder db = dbf.newDocumentBuilder();
                                 Document doc = db.parse(new ByteArrayInputStream(text.getBytes()));
                                 request.getSOAPBody().addDocument(doc);
                                
                                 SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
                                 SOAPConnection sc = scf.createConnection();
                                
                                 JAXWSClientMetaDataBuilder mdb = new JAXWSClientMetaDataBuilder();
                                 ServiceMetaData smd = mdb.buildMetaData(new QName("YOU SERVICE NS",
                                 "YOUR SERVICE"), new URL("YOUR WSDL URL"));
                                 EndpointMetaData emd = smd.getEndpoint(new QName("YOUR SERVICE NS",
                                 "YOU PORT NAME"));
                                
                                 SOAPMessageContextJAXWS mc = new SOAPMessageContextJAXWS();
                                 mc.setEndpointMetaData(emd);
                                 MessageContextAssociation.pushMessageContext(mc);
                                 SOAPMessage response = sc.call(request, new URL("YOUR ENDPOINT URL"));
                                 MessageContextAssociation.popMessageContext();
                                
                                 SOAPBody sb = response.getSOAPBody();
                                 NodeList list = sb.getChildNodes();
                                 for (int i = 0; i < list.getLength(); i++) {
                                 System.out.println(list.item(i));
                                 }
                                 }
                                


                                This works for me with jbossws-3.0.1-native-2.0.4.GA and JDK 5, but it is an ugly hack. I think I will try the RI and see if that works better.

                                • 13. Re: http://org.jboss.ws/http#chunksize
                                  thomas.diesler

                                  I moved this to the dev forum and here is your jira for it

                                  http://jira.jboss.org/jira/browse/JBWS-2124

                                  good work, btw