[jboss-user] [JBossWS] - Re: http://org.jboss.ws/http#chunksize
talekar
do-not-reply at jboss.com
Wed Apr 9 19:26:12 EDT 2008
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 at 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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143013#4143013
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143013
More information about the jboss-user
mailing list