Contributions
Encoding for JMS/SOAP BytesMessages
Hi, I tried to send a JMS/SOAP messages as a Bytes Message, but it seems that the encoding is wrong. I am using SOAPUI 5.0.0 on Windows, I have put in my request the character U+00B0 ° c2 b0 DEGREE SIGN My request property for encoding is set to UTF-8 When I send the message, I get a wrong encoding, using HermesJMS and looking at Hexadecimal tab I get 0xb0 instead of 0xc2 0xb0 as expected for UTF-8 If I send the message a a Text Message (i.e. not a BytesMessage) the encoding is correct. So I investigated a little bit with debugger and source code and found the following piece of code from com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport.createBytesMessageFromText(SubmitContext, String, Session): private Message createBytesMessageFromText( SubmitContext submitContext, String requestContent, Session session ) throws JMSException { BytesMessage bytesMessage = session.createBytesMessage(); bytesMessage.writeBytes(requestContent.getBytes()); return bytesMessage; } According to javadoc java.lang.String.getBytes(): /** * Encodes this {@code String} into a sequence of bytes using the * platform's default charset, storing the result into a new byte array. Unfortunately the value set for Windows is java.nio.charset.Charset.defaultCharset() (sun.nio.cs.MS1252) windows-1252 My proposed implementation would be the following one that takes into account the request encoding and not the platform encoding : private Message createBytesMessageFromText( SubmitContext submitContext, String requestContent, Session session ) throws JMSException { Request request = (Request) submitContext.getProperty(WSDL_REQUEST); BytesMessage bytesMessage = session.createBytesMessage(); bytesMessage.writeBytes( requestContent.getBytes(Charset.forName(request.getEncoding())) ); return bytesMessage; } Another approach is to force the file.encoding java property as proposed here viewtopic.php?f=13&t=21317&hilit=encoding+utf8 Best Regards, Franck10 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes1CommentWSDL 1.1 SoapAction for SOAP/JMS bindings
Hello, version 3.5.1 of SOAPUI allows adding the SoapAction as a JMS property. The implementation fills the value with the operation name, that seems to be in contradiction with SOAP/JMS specification W3C candidate Recommandation 4 June 2009 (http://www.w3.org/TR/2009/CR-soapjms-20090604). My understanding of §3.4.3 is that the SoapAction definition found in binding part should be used. Here is a snapshot of corresponding implementation from com.eviware.soapui.impl.wsdl.submit.transports.jms.HermesJmsRequestTransport: if( addSoapAction ) { message.setStringProperty( JMSHeader.SOAPJMS_SOAP_ACTION, request.getOperation().getName() ); message.setStringProperty( JMSHeader.SOAP_ACTION, request.getOperation().getName() ); } The implementation sends a non quoted JMS string property with the operation name. I think that SOAPUI should send the same SoapAction value in case of HTTP transport, i.e. for instance as shown in SOAP 1.1 W3C Note 08 May 2000 §6.1.1 (http://www.w3.org/TR/2000/NOTE-SOAP-20000508/): "http://electrocommerce.org/abc#MyMessage" Please note the presence of " arround string. The workaround we are currently using consists in disabling the 'Add SoapAction as property' checkbox and add a JMS property SoapAction with the soapAction defined in the binding part of the WSDL. Best Regards, Franck14 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes0CommentsSOAP/JMS binding transport W3C 4 June 2009
Hi, SOAPUI currently supports SOAP/JMS and this is really a nice feature, however norms concerning SOAP/JMS are not yet definitively frozen. Currently the class com.eviware.soapui.impl.wsdl.support.soap.SoapJMSBindingImporter is able to import SOAP/JMS binding defined with transportURI "http://www.soapjms.org/2007/08/soap/bindings/JMS/" Having a look at W3C site, we find the following specification for SOAP/JMS : http://www.w3.org/TR/2008/WD-soapjms-20081121 and http://www.w3.org/TR/2009/CR-soapjms-20090604 (latest one). The latest specification stands that transportURI should be "http://www.w3.org/2008/07/soap/bindings/JMS/". The patch is very simple and is somehting like: public boolean canImport( Binding binding ) { List<?> list = binding.getExtensibilityElements(); SOAPBinding soapBinding = WsdlUtils.getExtensiblityElement( list, SOAPBinding.class ); return soapBinding == null ? false : soapBinding.getTransportURI().startsWith( "http://www.soapjms.org/2007/08/soap/bindings/JMS/" ) || soapBinding.getTransportURI().startsWith( "http://www.w3.org/2008/07/soap/bindings/JMS/"); } Do you think it is possible to take into account this patch for next version (3.6) ? Thanks, Franck1KViews0likes1Comment