标签: jax-ws

Servlets + JAX-WS

我正在尝试通过JAX-WS注释公开Web服务方法.我见过的许多示例都引用了EndPoint.publish()方法,以便在独立应用程序中快速启动服务(来自Java Web Services:Up and Running,1st Edition):

public class TimeServerPublisher {
public static void main(String[ ] args) {
  // 1st argument is the publication URL
  // 2nd argument is an SIB instance
  Endpoint.publish("http://127.0.0.1:9876/ts", new TimeServerImpl());
}
Run Code Online (Sandbox Code Playgroud)

}

我缺少的一件事是如何在现有的应用程序中完成基本相同的事情.我会制作一个servlet来处理这个问题吗?在现有WAR文件中发布此服务的正确方法是什么?

java servlets jax-ws

5
推荐指数
1
解决办法
2157
查看次数

Weblogic webservice客户端.(干净的参考)

我创建了一个端口池(webservice客户端),因为在每次请求时动态创建客户端会导致瓶颈

现在我注意到webservice客户端持有对请求和响应的引用......

这是正常的......?

不幸的是,对于这个web服务来说,有效载荷非常大,就像这样,即使暂时不使用,池也会保留对某些不再使用的响应的引用...增加堆...

收到回复后有没有办法清理这些引用?

更新:使用Apache CXF客户端我没有这个问题但是pb.仍然对weblogic客户开放..

java web-services weblogic java-metro-framework jax-ws

5
推荐指数
1
解决办法
2064
查看次数

JAX-WS Java客户端,WCF服务互操作性:"400:错误请求"

我也在Mirth论坛上问了这个问题.

我们目前正在尝试使用开源医疗保健集成引擎Mirth连接到WCF服务.Mirth是基于Java的,在内部使用Mule,它使用JAX-WS.WCF服务器返回HTTP状态代码"400:错误请求".我们无法轻松访问WCF服务器.

与客户的通信在C#中运行良好.在Visual Studio中,添加服务引用,然后在main()中:

PatientRegistryQueryFulfiller.GetDemographicsClient svc = new PatientRegistryQueryFulfiller.GetDemographicsClient();
doc.Load(@"C:\MirthTesting\PRPA_EX201307NO_10_PatientReg_GetDemographics.xml");
PatientRegistryQueryFulfiller.PRPA_IN201307NO patientRegistryRequest = (PatientRegistryQueryFulfiller.PRPA_IN201307NO)ObjectSerializer.DeserializeObject(doc, typeof(PatientRegistryQueryFulfiller.PRPA_IN201307NO));
PatientRegistryQueryFulfiller.PRPA_IN201307NOResponse patientRegistryResponse = svc.GetDemographics(patientRegistryRequest);
doc = ObjectSerializer.SerializeObject(patientRegistryResponse.Item);
Run Code Online (Sandbox Code Playgroud)

自动生成的WCF客户端(来自WSDL)具有带端点的app.config,并且此绑定:

<bindings>
    <basicHttpBinding>
        <binding name="PatientRegistryQueryFulfiller_Binding" closeTimeout="00:01:00"
         openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
         allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
         maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
         messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
         useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="655360"
           maxBytesPerRead="4096" maxNameTableCharCount="655360" />
        <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
             realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)

在WCF解决方案中唯一不同的做法是在相关绑定的readerQuotas标记中扩展maxNameTableCharCount和maxArrayLength,其余部分保留默认值.但是,我还没有找到在Mirth中设置这些的方法,如果这确实是错误的原因.

我们正在运行Mirth v 2.2.1(最近结账),并且Mirth Channel设置为读取和发送HL7v3文档.只有在尝试与WCF服务进行通信时才会出现问题.目标是Web Service Sender,从WSDL读取服务和端口.没有任何验证,信封是从唯一可用的操作生成的.我们没有使用MTOM.

我们相当确定这与JAX-WS和WCF互操作性有关.任何一般提示?

我们已经尝试在JAX-WS连接上设置属性.在欢乐的深处,我们尝试设置http块大小:dispatch.getRequestContext().put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE,8192)(WebServiceMessageDispatcher.Java line 140)

堆栈跟踪如下:

ERROR-410: Web Service …
Run Code Online (Sandbox Code Playgroud)

wcf jax-ws mule mirth

5
推荐指数
1
解决办法
6916
查看次数

如何设置自定义JAXBContext

我想问一个关于jax-ws中@UsesJAXBContext注释的问题.我试图让它在客户端工作,但我可能会遗漏一些东西.这是我的情况:

我有web操作的操作:

@WebMethod(operationName = "putToQueue")
public boolean put(@WebParam(name = "queueName") String queueName, @WebParam(name = "element") Object element) {
    return queues.get(queueName).offer(element);
}
Run Code Online (Sandbox Code Playgroud)

在客户端,我生成了QueueService和Queue(端口)......以及其他东西...... [响应请求.在这种情况下无关紧要.]我想让用户定义他/她可以放入队列的对象.但是,为了调用操作put(...),我需要将绑定对象(我尝试发送)放入JAXBContext中.我可以通过@XmlSeeAlso在生成的Queue存根的顶部做到这 一点 [我试过这个并且它可以工作].尽管如此,我需要更通用的解决方案来帮助我在运行时绑定对象.我认为我可以创建@QueueMessage注释和ClientJAXBContextFactory,并在创建时将标记的类添加到上下文中.

public class ClientJAXBContextFactory implements JAXBContextFactory {

    @Override
    public JAXBRIContext createJAXBContext(SEIModel seim, List<Class> classes, List<TypeReference> references) throws JAXBException {
        Reflections reflections = new Reflections("");
        Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(QueueMessage.class);
        classes.addAll(annotated);

        return JAXBContextFactory.DEFAULT.createJAXBContext(seim, classes, references);
    }
}
Run Code Online (Sandbox Code Playgroud)

接下来我尝试在生成的Queue之上使用@UsesJAXBContext.

@WebService(name = "Queue")
@UsesJAXBContext(ClientJAXBContextFactory.class)
public interface Queue { …
Run Code Online (Sandbox Code Playgroud)

java annotations java-metro-framework jax-ws jaxb

5
推荐指数
1
解决办法
3833
查看次数

禁用自动生成的JAX-WS状态页面

当部署并运行用JAX-WS开发的Web服务时,我可以看到一个摘要页面,其中包含一些信息,如下图所示:

http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/ Web服务状态页面

对于最终实现,我们希望删除该页面,以便在返回自定义页面或空白页面的同时仍然可以访问Web服务端点。

我们当前正在Tomcat上运行。

tomcat web-services jax-ws

5
推荐指数
1
解决办法
1056
查看次数

如何获取我的WSDL的URL?

我使用Netbeans,Java EE6,JAX-WS和TomCat创建了一个非常简单的Web服务.它只有一个@WebMethod getWsdlURL(),它应该返回我的wsdl的URL,它应该类似于:

http://192.168.70.44:8088/SimpleWebService/WebService?wsdl
Run Code Online (Sandbox Code Playgroud)

但是,我不知道如何做到这一点.

谁能帮我?

java tomcat web-services jax-ws

5
推荐指数
1
解决办法
5万
查看次数

Jax-ws:从请求对象中删除名称空间前缀

我在Jax-WS中遇到问题,我公开的服务无法处理以下消息:

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header>
        <CCGW_CUSTOM_HEADER xmlns="">
            <CCGW_CUSTOM_HEADER xmlns="Key">&lt;?xml version="1.0" encoding="utf-16"?&gt;&amp;#xD;&lt;CcgwCustomHeaderData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&amp;#xD; &lt;ClientSystemType&gt;ClientSystem&lt;/ClientSystemType&gt;&amp;#xD;&lt;/CcgwCustomHeaderData&gt;</CCGW_CUSTOM_HEADER>
        </CCGW_CUSTOM_HEADER>
    </S:Header>
    <S:Body>
        <HeartbeatRequest xmlns="http://my-site.com/CCGWCallback">
            <conferenceId>this is a heartbeat</conferenceId>
        </HeartbeatRequest>
    </S:Body>
</S:Envelope>
Run Code Online (Sandbox Code Playgroud)

但是,服务器能够处理此消息:

  <?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header>
        <CCGW_CUSTOM_HEADER xmlns="">
            <CCGW_CUSTOM_HEADER xmlns="Key">&lt;?xml version="1.0" encoding="utf-16"?&gt;&amp;#xD;&lt;CcgwCustomHeaderData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&amp;#xD; &lt;ClientSystemType&gt;ClientSystem&lt;/ClientSystemType&gt;&amp;#xD;&lt;/CcgwCustomHeaderData&gt;</CCGW_CUSTOM_HEADER>
        </CCGW_CUSTOM_HEADER>
    </S:Header>
    <S:Body>
        <ns2:HeartbeatRequest xmlns:ns2="http://my-site.com/CCGWCallback">
            <conferenceId xmlns="">this is a heartbeat</conferenceId>
        </ns2:HeartbeatRequest>
    </S:Body>
</S:Envelope>
Run Code Online (Sandbox Code Playgroud)

我想要做的是找到一种方法来删除":ns2"前缀.

我将感激你的帮助.

Nadav

jax-ws jax-ws-customization

5
推荐指数
0
解决办法
716
查看次数

Mule ESB错误>>"有两个变换器完全匹配输入

我是骡子的新手.

我尝试使用SOAP创建一个简单的登录流程,它将返回XML Response.我的方法是用XML发送数据,然后我将登录数据保存在转换代码中,保存数据后,返回数据将生成为xml响应.但我有错误"有两个变压器完全匹配输入".我不明白为什么会这样.请帮我解决这个问题.

这是我的流程代码:

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" 

port="8081" doc:name="HTTP Listener Configuration"/>
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true" doc:name="CXF Configuration"/>
<mulexml:jaxb-context name="myJaxb" packageNames="com.test.service" doc:name="JAXB Context"/>

<flow name="LoginFlow" initialState="started">
<http:listener config-ref="HTTP_Listener_Configuration" path="/Login" doc:name="HTTP"/>
<cxf:proxy-service configuration-ref="CXF_Configuration" doc:name="CXF" namespace="http://www.test.co.id/SOA/service/1.0" payload="body" port="LoginPort" service="LoginService" wsdlLocation="service/login-test.wsdl"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<mulexml:dom-to-xml-transformer returnClass="java.lang.String" doc:name="DOM to XML"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<custom-transformer class="com.test.transform.XMLTransform" doc:name="XML To Java" returnClass="com.test.service.LoginResponse"/>
<mulexml:jaxb-object-to-xml-transformer jaxbContext-ref="myJaxb" doc:name="JAXB Object to XML"/>
<mulexml:xml-to-dom-transformer doc:name="XML to DOM"/>
</flow>
Run Code Online (Sandbox Code Playgroud)

错误堆栈:

1. There are two transformers that are an exact match for input: …
Run Code Online (Sandbox Code Playgroud)

xml cxf jax-ws transformer-model mule

5
推荐指数
1
解决办法
1509
查看次数

5
推荐指数
1
解决办法
4283
查看次数

错误从MTOM的Web服务解组jaxb

我有一个使用基于模式的有效负载的jax-ws Web服务.添加MTOM附件类型:

<xs:element name="Attachment" type="xs:base64Binary"
            xmime:expectedContentTypes="application/octet-stream" 
            minOccurs="0" maxOccurs="1" >
</xs:element>
Run Code Online (Sandbox Code Playgroud)

ws-import生成的java文件看起来正确:

@XmlRootElement(name = "Contact")
public class Contact {
    @XmlElement(name = "Attachment")
    @XmlMimeType("application/octet-stream")
    protected DataHandler attachment;
Run Code Online (Sandbox Code Playgroud)

使用soapUI发送请求.

HTTP标头:

 Accept-Encoding: gzip,deflate
 Content-Type: multipart/related; type=application/xop+xml; start=<rootpart@soapui.org>; start-info=text/xml; boundary=----=_Part_96_20541990.1485816424570
 SOAPAction: http://hsn.us.banner.hsntech.com/Level1Request
 MIME-Version: 1.0
 Content-Length: 47624
  [1]: https://i.stack.imgur.com/BEbZS.jpg
Run Code Online (Sandbox Code Playgroud)

然后查看带有编码文件部分的HTTP部分:

------=_Part_96_20541990.1485816424570"
Content-Transfer-Encoding: binary"
Content-ID: <test1.jpg>"
Content-Disposition: attachment; name="test1.jpg"; filename="test1.jpg""
[0xff][0xd8][0xff][0xe0][0x0][0x10]JFIF[0x0][0x1][0x1][0x1][0x0]`[0x0]`[0x0][0x0][0xff][0xdb][0x0]C[0x0][\n]"... etc...
Run Code Online (Sandbox Code Playgroud)

但不断收到此错误:

[Exception [EclipseLink-25004] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.XMLMarshalException&#xd;
Exception Description: An error occurred unmarshalling the document&#xd;
Internal Exception: java.lang.IllegalArgumentException: MjAxNi0wMS0wNVQwOTowMDowMA==]</faultstring></ns0:Fault></S:Body></S:Envelope>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

java mtom jax-ws jaxb eclipselink

5
推荐指数
1
解决办法
304
查看次数