Home > front end >  CXF namespace prefix
CXF namespace prefix

Time:10-30

In a recent study of Java web service, using the CXF framework, all goes well, but is looking at the default generated namespace prefix is a bit uncomfortable
This is the interface
 @ WebService (targetNamespace="http://www.hehe.shabi.com" name="hehe" serviceName="heheService") 
Public interface ITestService {
@ the WebResult (name="RESULT")
String syaHello (@ the WebParam (name="name") String name);
}

This is to achieve
 public class TestService implements ITestService {

Public String syaHello (String name) {
Return the name +, "hello";
}

}

The inside of the spring configuration
 & lt; Bean id="test" & gt; & lt;/bean> 

 & lt; Jaxws: the endpoint implementor="# test" address="/test & gt;" 
& lt;/jaxws: endpoint>


This is to use soapui generated call
 & lt; Soapenv: Envelope XMLNS: soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
XMLNS: hehe="http://www.hehe.shabi.com" & gt;
& lt; Soapenv: Header/& gt;
& lt; Soapenv: Body>
& lt; Hehe: syaHello>
& lt; Name> 34 & lt;/name>
& lt;/hehe: syaHello>
& lt;/soapenv: Body>
& lt;/soapenv: Envelope>


SyaHello is generated according to the namespace prefix hehe, take the namespace is not fixed, cannot be changed out of his, if change, take the prefix will also change, the prefix can be set separately?

The response is a bit awkward
 & lt; The soap: Envelope XMLNS: soap="http://schemas.xmlsoap.org/soap/envelope/" & gt; 
& lt; Soap: Body>
& lt; Ns2: syaHelloResponse XMLNS: ns2="http://www.hehe.shabi.com" & gt;
& lt; RESULT> Hi, 34 & lt;/RESULT>
& lt; :/ns2 syaHelloResponse>
& lt;/soap: Body>
& lt;/soap: Envelope>


Where is the ns2, can be set free? SyaHelloResponse introduced in ns2, this can be in the soap: Envelope in the introduction?

See online said, add an attribute
 & lt; Jaxws: the endpoint implementor="# test" address="/test & gt;" 
& lt; Jaxws: properties>
& lt; Entry key="soap. The env. Ns. Map" & gt;
& lt; Map>
& lt; Entry value="http://www.hehe.shabi.net" key="hehe" & gt; & lt;/entry>
& lt;/map>
& lt;/entry>
& lt;/jaxws: properties>
& lt;/jaxws: endpoint>

Call no change, but the response is a little look not to understand the
 & lt; The soap: Envelope XMLNS: soap="http://schemas.xmlsoap.org/soap/envelope/" 
XMLNS: hehe="http://www.hehe.shabi.net" & gt;
& lt; Soap: Body>
& lt; Ns2: syaHelloResponse XMLNS: ns2="http://www.hehe.shabi.com" & gt;
& lt; RESULT> Hi, 34 & lt;/RESULT>
& lt; :/ns2 syaHelloResponse>
& lt;/soap: Body>
& lt;/soap: Envelope>


How do help namespace prefix in specific Settings?

CodePudding user response:

How can nobody, webservice so mature technology,,,,,,,,,,,,,,,,,,,,,,,,

CodePudding user response:

,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

CodePudding user response:

The great god, how do you the name of a namespace prefix? Now I am using CXF release webservice two problems: 1, modify the namespace can change the default namespace package name? 2, the input parameters for the entity class, issued a message in the front of the entity class how to add a namespace prefix?

CodePudding user response:

According to http://cxf.547215.n5.nabble.com/How-to-customize-namespaces-position-and-prefix-in-CXF-response-td3423069.html, should be in. The XML configuration files to add
& lt; Entry key="disable. Outputstream. Optimization" value="https://bbs.csdn.net/topics/true"/& gt;
The XML file configuration should be
& lt; Jaxws: the endpoint id="doubleHotline implementor=" # doubleHotlineService "address"="/doubleHotline" & gt;
& lt; Jaxws: properties>
& lt; Entry key="soap. The env. Ns. Map" & gt;
& lt; Map>
& lt; Entry value="http://esb.lzccb.com" key="esb" & gt; & lt;/entry>
& lt; Entry value="http://esb.lzccb.com/business/callcenter/DouHotLineService" key="douh & gt;" & lt;/entry>
& lt;/map>
& lt;/entry>
& lt; Entry key="disable. Outputstream. Optimization" value="https://bbs.csdn.net/topics/true"/& gt;

& lt;/jaxws: properties>
& lt; Jaxws: inInterceptors>
& lt; Ref bean="loggingInInterceptor"/& gt;
& lt;/jaxws: inInterceptors>
& lt; Jaxws: outInterceptors>
& lt; Ref bean="the loggingOutInterceptor"/& gt;
& lt;/jaxws: outInterceptors>
& lt;/jaxws: endpoint>
Finally using SoapUI test out the response message is:
& lt; The soap: Envelope XMLNS: soap="http://schemas.xmlsoap.org/soap/envelope/" XMLNS: the esb="http://esb.lzccb.com" XMLNS: douh="http://esb.lzccb.com/business/callcenter/DouHotLineService" & gt;
& lt; Soap: Header>
& lt; The esb: RouteInformation>
& lt; The esb: SourceId> ? & lt;/esb: SourceId>
& lt; The esb: AuthCode> ? & lt;/esb: AuthCode>
& lt; The esb: GoalId> ? & lt;/esb: GoalId>
& lt; The esb: ServiceName> ? & lt;/esb: ServiceName>
& lt; The esb: OperationName> ? & lt;/esb: OperationName>
& lt; The esb: RouteMsgId> ? & lt;/esb: RouteMsgId>
& lt; The esb: TimeOut> ? & lt;/esb: TimeOut>
& lt; The esb: RelatesTo> ? & lt;/esb: RelatesTo>
& lt;/esb: RouteInformation>
& lt;/soap: Header>
& lt; Soap: Body>
& lt; Douh: doubleHotLineResponse>
& lt; Douh: ResponseType> E
& lt; Douh: ResponseCode> 111000 & lt;/douh: ResponseCode>
& lt; Douh: ResponseMessage> Detailed content of the field is not in conformity with the specification & lt;/douh: ResponseMessage>
& lt; Douh: doubleHotLineRespData/& gt;
& lt;/douh: doubleHotLineResponse>
& lt;/soap: Body>
& lt;/soap: Envelope>nullnull
  • Related