[jboss-user] [JBossWS] - Re: How can I print to log file input soap request and respo

nicvas do-not-reply at jboss.com
Thu Mar 12 12:33:22 EDT 2009


Solution for:
server: jbossas 4.2.1.GA
server library: jbossws-1.2
source library: jbossws-src-1.2.1.GA in http://www.jboss.org/jbossws/downloads/
jar_path: jboss/server/default/deploy/jbossws.sar/jbossws-core.jar
package: org.jboss.ws.core.jaxws
class: JAXBDeserializer
method: public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException

Must be add the code below: 
String sourceString = sourceToString(xmlFragment);
if(log.isDebugEnabled()) log.debug("InputSourceString: "+sourceString);

below the  method upgraded: 
public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment, SerializationContext serContext) throws BindingException
   {
      if(log.isDebugEnabled()) log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");

      
      Object value = null;
      try
      {
        String sourceString = sourceToString(xmlFragment);
        if(log.isDebugEnabled()) log.debug("InputSourceString: "+sourceString);
                    
         
         Class[] javaTypes = (Class[])serContext.getProperty(SerializationContextJAXWS.CONTEXT_TYPES);

         TypeMappingImpl typeMapping = serContext.getTypeMapping();
         Class javaType = typeMapping.getJavaType(xmlType); // es. javaType: class org.isc.are.ws.jaxws.GetBanner
         
         JAXBContext jaxbContext = getJAXBContext(javaTypes);

         Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
         
        //SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        //Source schemaSource = new StreamSource(new File("/home/jboss/jboss/testdatasource/ARE_GetBannerService.xsd"));
        //Schema schema = schemaFactory.newSchema(schemaSource);
         //unmarshaller.setSchema(schema);
        
         unmarshaller.setAttachmentUnmarshaller( new AttachmentUnmarshallerImpl());
         JAXBElement jbe = unmarshaller.unmarshal(xmlFragment, javaType);
         value = jbe.getValue();

         if(log.isDebugEnabled()) log.debug("deserialized: " + (value != null ? value.getClass().getName() : null)); //deserialized: org.isc.are.ws.jaxws.GetBanner
      }
      catch (Exception ex)
      {
          log.error("error during deserialize.", ex);
         handleUnmarshallException(ex);
      }
      return value;
   }

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217571#4217571

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217571



More information about the jboss-user mailing list