java - Wrong Encoding in JAX-WS Dispatch Response -


I am trying to use a web service with JX-WS:

  Dispatch & lt; Source & gt; SourceDispatch = null; SourceDispatch = service.createDispatch (portQName, source.class, Service.Mode.PAYLOAD); Source result = sourceDispatch.invoke (new stream resource (new string header (rik)); Println (sourceToXMLString (results)); Where:  
  Private Static String Source Talk ML String (Source Results) Transformer Configuration Option, Transformer Expression {String xmlResult = null; Try {Transformer Factor Factory = Transformerfacture.New Instance (); Transformer Transformer = Factory NAV transformer (); Transformer.SetOptputPropti (OutputKeys.Imidx_LADCLARATION, "Yes"); Transformer. Setoptputproperty (OutputKE.H.O.D.O.D., "XML"); Transformer.SetOutputProperty (OutputKies encoding, "UTF-8"); OutputStream Out = New byteOutStream (); Stream result stream result = new stream result (); StreamResult.setOutputStream (outside); Transformer. Transform (results, stream resolve); XmlResult = streamResult.getOutputStream (). ToString (); } Grip (Transformer Experimentation E) {e.printStackTrace (); } Return xmlResult; }  

When I print the result on a utf-8 page, utf-8 characters are not displayed correctly.

Since WS works fine with other tools (return UTF-8 penalty), I think my change is with some problem with sourceToXMLString () Is it my encoding Can you destroy?

Try the following:

  Private Static String SourcesOxLL string (source Result) Transformer Configuration Option, Transformer Expression {string xmlResult = null; Try {Transformer Factor Factory = Transformerfacture.New Instance (); Transformer Transformer = Factory NAV transformer (); Transformer.SetOptputPropti (OutputKeys.Imidx_LADCLARATION, "Yes"); Transformer. Setoptputproperty (OutputKE.H.O.D.O.D., "XML"); Transformer.SetOutputProperty (OutputKies encoding, "UTF-8"); BitReon OutputStream Out = New ByteOroutOfStream (); Transformer. Transform (result, new stream result); XmlResult = out.toString ("UTF-8"); // or xmlResult = new string (out.Tobetray (), "UTF-8"); } Grip (Transformer Experimentation E) {e.printStackTrace (); } Return xmlResult; }  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -