[JBossWS] - Re: How Do I See the XML?
by flindet
rmartony, here's what I ended up doing to log my full SOAP message. It's based heavily on the example handlers included with JBossWS.
| public class ProtocolHandler extends GenericSOAPHandler
| {
| /**
| * The {@link Logger} used for writing logging messages.
| */
| private static Logger log = Logger.getLogger(ProtocolHandler.class);
|
| /* (non-Javadoc)
| * @see org.jboss.ws.core.jaxws.handler.GenericSOAPHandler#handleOutbound(javax.xml.ws.handler.MessageContext)
| */
| @Override
| public boolean handleOutbound(final MessageContext msgContext)
| {
| if (log.isInfoEnabled())
| {
| return logMessage(msgContext);
| }
| return true;
| }
|
| /* (non-Javadoc)
| * @see org.jboss.ws.core.jaxws.handler.GenericSOAPHandler#handleInbound(javax.xml.ws.handler.MessageContext)
| */
| @Override
| public boolean handleInbound(final MessageContext msgContext)
| {
| if (log.isInfoEnabled())
| {
| return logMessage(msgContext);
| }
| return true;
| }
|
| /**
| * Logs the full SOAP message.
| *
| * @param messageContext The message context containing the SOAP message to be handled.
| * @return True if handler processing should continue, false otherwise.
| * @throws WebServiceException If the SOAP message is malformed.
| */
| private boolean logMessage(final MessageContext messageContext)
| {
| try
| {
| SOAPMessage soapMessage = ((SOAPMessageContext) messageContext).getMessage();
| if (soapMessage.getSOAPBody().getChildElements().hasNext())
| {
| SOAPElement soapElement = (SOAPElement) soapMessage.getSOAPBody().getChildElements().next();
| if (soapElement.getChildElements().hasNext())
| {
| soapElement = (SOAPElement) soapElement.getChildElements().next();
|
| ByteArrayOutputStream xmlStream = new ByteArrayOutputStream();
| soapMessage.writeTo(xmlStream);
| log.info(new String(xmlStream.toByteArray()));
| }
| }
|
| return true;
| }
| catch (SOAPException ex)
| {
| throw new WebServiceException(ex);
| }
| catch (IOException ex)
| {
| throw new WebServiceException(ex);
| }
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035389#4035389
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035389
17 years, 8 months
[JBossWS] - [Fatal Error] :-1:-1: Premature end of file.
by nicolemans72
I work on an application to test JBossWS
I have a web service which turns on a JBoss AS 4.0.5 server, which returns a complex type object, "Dmex"
I have this client:
| try {
|
| ServiceFactoryImpl factory=new ServiceFactoryImpl();
| URL wsdlLocation = new URL("http://localhost:8080/DmexWs" + "?wsdl");
| URL mappingUrl=new File("src/java/jaxrpc-mapping.xml").toURL();
| QName serviceName = new QName("urn:bsa.ws.test", "DmexWs");
| Service service = (Service)factory.createService(wsdlLocation, serviceName,mappingUrl);
| Call call = service.createCall();
|
| QName operationName = new QName("urn:bsa.ws.test", "getDmex");
| call.setOperationName(operationName);
|
| Integer id = new Integer(274);
| Object retObj = call.invoke(new Object[]{id});
|
| System.out.println(retObj);
| } catch (Exception e) {
| e.printStackTrace();
| }
|
and when I run the client, I have this error:
| [Fatal Error] :-1:-1: Premature end of file.
|
Any idea?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035346#4035346
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035346
17 years, 8 months
[JBossWS] - Re: Mapping problem
by nicolemans72
I solved this problem by using ServiceFactoryImpl instead of ServiceFactory
But now I have some errors to parse my jaxrpc-mapping.xml file at the line
| Service service = (Service)factory.createService(wsdlLocation, serviceName,mappingUrl);
|
| org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
| at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:100)
| at org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory.parse(JavaWsdlMappingFactory.java:79)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:77)
| at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:111)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:142)
| at jbosstest.HelloClient.testDmex(HelloClient.java:95)
|
Any ideas?
I need answers quickly plz
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035054#4035054
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035054
17 years, 8 months
[JBossWS] - Salesforce client stub generation fails
by artd
I'm trying to move away from Axis due to what appear to be classloading issues when Axis is included in a deployed webapp, and exposing portions of the webapp are exposed using JBOSSWS. So I figured I would just convert the Axis stubs to JBOSSWS stubs using wsconsume.
I've tried JBOSS AS 4.0.5, 4.2.0 with the native JBOSSWS and upgrades to 1.2.0SP1 to no avail.
With the latest, 1.2.0SP1 I get the following exception
| [wsconsume] Command invoked: org.jboss.ws.tools.jaxws.command.wsconsume -k -o "C:\Documents and Settings\adalessandro\Workspace\AxaptaSOAPClient" -s "C:\Documents and Settings\adalessandro\Workspace\AxaptaSOAPClient\src" -t enterprise.wsdl
| [wsconsume] warning: src-resolve: Cannot resolve the name 'ens:sObject' to a(n) 'type definition' component.
| [wsconsume] line ? of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema2
| [wsconsume] error: A class/interface with the same name "com.sforce.soap.enterprise.DescribeLayout" is already in use. Use a class customization to resolve this conflict.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema2
| [wsconsume] error: (Relevant to above error) another "DescribeLayout" is generated from here.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema2
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema2
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema2
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: Two declarations cause a collision in the ObjectFactory class.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] error: (Related to above error) This is the other declaration.
| [wsconsume] line 0 of file:/C:/Documents%20and%20Settings/adalessandro/Workspace/AxaptaSOAPClient/enterprise.wsdl#types?schema1
| [wsconsume] com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:213)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.config.ModelInfo.buildModel(ModelInfo.java:88)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.Processor.runModeler(Processor.java:82)
| [wsconsume] at org.jboss.com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:543)
| [wsconsume] at org.jboss.com.sun.tools.ws.util.ToolBase.run(ToolBase.java:57)
| [wsconsume] at org.jboss.ws.tools.jaxws.impl.WSContractConsumerImpl$1.run(WSContractConsumerImpl.java:163)
| [wsconsume] at org.jboss.ws.tools.jaxws.impl.WSContractConsumerImpl.consume(WSContractConsumerImpl.java:166)
| [wsconsume] at org.jboss.ws.tools.jaxws.command.wsconsume.importServices(wsconsume.java:194)
| [wsconsume] at org.jboss.ws.tools.jaxws.command.wsconsume.main(wsconsume.java:77)
| [wsconsume] Caused by: com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:128)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2207)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:224)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:181)
| [wsconsume] ... 8 more
| [wsconsume] Caused by: com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.
| [wsconsume] at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:66)
| [wsconsume] at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:152)
| [wsconsume] at com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:19)
| [wsconsume] at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:210)
| [wsconsume] at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:151)
| [wsconsume] at com.sun.tools.xjc.model.Model.generateCode(Model.java:230)
| [wsconsume] at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:217)
| [wsconsume] at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:67)
| [wsconsume] at org.jboss.com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:126)
| [wsconsume] ... 11 more
| [wsconsume] error: com.sun.istack.SAXParseException2: (Related to above error) This is the other declaration.
|
Any suggestions on how to resolve? I couldn't find any exact JIRA issues on this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035002#4035002
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035002
17 years, 8 months