简体   繁体   English

如何在Perl中创建SOAP服务器?

[英]How can I create a SOAP server in Perl?

I'm working with a third-party vendor who unfortunately requires that we set up a SOAP server to handle requests from them. 我正在与第三方供应商合作,不幸的是我们要求我们设置一个SOAP服务器来处理来自它们的请求。 I'm having some trouble finding the best way to go about this. 我找不到最好的方法来解决这个问题。 One limitation I'm imposing is that it runs as a mod_perl2 handler. 我强加的一个限制是它作为mod_perl2处理程序运行。 After some searching I've found that the best way may be to use XML::Compile and its SOAP classes but I'm having a tough time wrapping my head around it. 经过一些搜索后,我发现最好的方法可能是使用XML :: Compile及其SOAP类,但是我很难绕过它。 Part of the problem is my limited understanding of SOAP and the documentation for most modules seems a bit cryptic to me. 问题的一部分是我对SOAP的理解有限,大多数模块的文档似乎对我来说有点神秘。

So, can anyone give me some pointers, sample code, anything? 那么,任何人都可以给我一些指示,示例代码,任何东西吗?

EDIT: we were also given a WSDL file to use, and this was not compatible with SOAP::WSDL ("unsupported global type found in ... Looks like a rpc/literal WSDL, which is not supported by SOAP::WSDL) 编辑:我们还获得了一个WSDL文件供使用,这与SOAP :: WSDL不兼容(“不支持的全局类型在......中看起来像一个rpc / literal WSDL,SOAP :: WSDL不支持)

EDIT: XML::Compile::SOAP complains "RPC encoded not supported by this version" when using the WSDL with XML::Compile::WSDL11. 编辑:当使用带有XML :: Compile :: WSDL11的WSDL时,XML :: Compile :: SOAP抱怨“此版本不支持RPC编码”。 Can/should I not worry about the WSDL file? 可以/我应该不担心WSDL文件?

If you have a limited understanding of SOAP, starting reading about SOAP before you worry about implementing it. 如果您对SOAP的理解有限,请在担心实现之前开始阅读SOAP。 There are lots of SOAP tutorials out there. 那里有很多SOAP教程 Most of the documentation probably seems cryptic to you because you don't already know SOAP. 大多数文档可能看起来很神秘,因为你还不知道SOAP。

It's not that tricky of a process. 这不是一个过程的棘手问题。 It's not that different than any other web programming when it comes to the big steps: 当涉及到重大步骤时,它与任何其他Web编程没有什么不同:

  • You get a SOAP request, which is some XML. 你得到一个SOAP请求,它是一些XML。
  • You pull apart the XML to figure out what to do. 你拆开XML来弄清楚要做什么。
  • You put together some XML to send as a response. 您将一些XML放在一起作为响应发送。
  • You return the response. 您返回响应。

XML::Compile will take care of most of the details for you. XML :: Compile将为您处理大部分细节。

Before you start writing your own server, you might consider writing a client for an existing SOAP server just to give yourself some practice. 在开始编写自己的服务器之前,您可能会考虑为现有的SOAP服务器编写客户端,只是为了给自己一些练习。

I found two modules that can help you make soap server, but I never use its 我找到了两个可以帮助你制作肥皂服务器的模块,但我从不使用它

https://metacpan.org/pod/XML::Compile::SOAP::Daemon https://metacpan.org/pod/XML::Compile::SOAP::Daemon

https://metacpan.org/pod/SOAP::WSDL::Server https://metacpan.org/pod/SOAP::WSDL::Server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM