tcp上的传统SOAP服务

时间:2013-03-10 03:08:11

标签: java soap

我有一个遗留服务应用程序,必须由我在 java 中编写的应用程序使用。旧服务使用SOAP over TCP(而不是HTTP)。

如果服务上有一个名为GetFoo()的方法,我必须发送

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" >
   <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <GetFoo xmlns="FooManagerAPI">
         <FooID xmlns="FooManagerAPI" xsi:type="xsd:int" >1</QualifiedECUID>
      </GetFoo>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

到运行服务的特定TCP端口,服务将返回

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" >
   <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <resultStruct>
             <FooName  xsi:type="xsd:string" >FirstFoo</FooName>
             <IsActive xsi:type="xsd:boolean">true</IsAction>              
      </resultStruct>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

如果我定义

class Foo
{
    String FooName;
    boolean IsActive;
}

interface IFooService
{
    Foo GetFoo(int FooId);
}

遗留应用程序拥有100多种此类方法,我试图避免为每种方法手动处理消息。我想知道,如果没有手动生成和解析SOAP消息并创建TCP套接字来中继和重用它们,有没有办法自动执行IFooService以供我的java应用程序使用?

0 个答案:

没有答案