In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to build the actual message format of SOAP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Because you need to do an interface interface for SOAP, if the other side's environment is not ready, you can't grab the packet, and you will only call the structure that doesn't understand the format. We just want to make a lightweight interface. You don't need to support the specific format of SOAP. You just need to parse the string according to the specific parameter name specified by the interface.
Therefore, it is necessary to determine the message format of soap by grabbing packets to facilitate string parsing and message assembly.
So I'm going to build a soap environment for php and grab the package.
Current environment
Centos6.3 system, default php does not support soap, downloaded php5.6 version
Compile
. / configure'--with-libxml-dir=/usr/lib''--with-zlib''--with-gd''--with-zlib-dir=/usr/local''--with-mysql''--enable-sockets''--enable-mbstring''--enable-soap''--enable-safe-mode''--enable-ftp''--with-png-dir=/usr/local''--with-freetype-dir=/ Usr/local''- with-jpeg-dir=/usr/local''- with-sqlite=shared'
It is found that the corresponding iconv library cannot be found. It is estimated that it cannot be found in the default path.
So recompile the iconv library and set. / configure-- prefix=/usr/local/libiconv
Then compile php and add a sentence'--with-iconv=/usr/local/libiconv'
. / configure'--with-libxml-dir=/usr/lib''--with-zlib''--with-gd''--with-zlib-dir=/usr/local''--with-mysql''--enable-sockets''--enable-mbstring''--enable-soap''--enable-safe-mode''--enable-ftp''--with-png-dir=/usr/local''--with-freetype-dir=/ Usr/local''--with-jpeg-dir=/usr/local''--with-sqlite=shared''--with-iconv=/usr/local/libiconv'
Make
Make install
Php-m | grep soap
Shows that the installation is successful
It is tragic to find that the phpinfo of apache uses php or version 5.3.3, replace / usr/bin/php with the new version, restart apache, but it does not work, using the old version of php. After searching for a long time, I couldn't find a solution.
In another way, set soap.so into php.ini, but it turns out that php didn't compile the library at all, only an opcache.so. According to the online method, prepare to compile the ext/soap under the php installation directory to make so, and found that there is no configure, it is estimated to be the function of the old version. I wanted to look for version 5.3.3, but the official position is no longer such an old version.
After checking the new features of various versions of php, it is found that the current php supports a built-in http server.
Php-S localhost:3300-t / path/to/root
You can start a http service with port 3300, so you don't have to mess with the damn apache.
Follow the online process to build a server and client.
First, put the Server.wsdl.
Red returns the result, two parameters, one is result, the other is the error reason, the type is wsdl:types, especially messy, for this return value for a long time, the other side is using java, also do not understand.
Cyan is the input parameter, 5 independent parameters, very simple.
Purple is the request address, and when the client gets the wsdl, it will request data from this address.
Look at client2.php.
It's very simple, just two sentences, passing in five parameters through wsdl.
Look at Server.php again.
Notice that this is the url address in the purple box in wsdl.
It's just as simple.
Grab the bag and start php client2.php
Check the packet capture message, the format is very simple, it is easy to build strings, and it is not difficult to parse fixed parameters.
But there is a problem, that is, the return value (0), the return value is not recognized. It seems impossible to return a zero.
Here, print the format of the return value in client.
When I found out it was stdclass object, I made the following changes in function TESTSOAP
$andy = array (); $andy = (object) $andy;$andy- > a = 100th -> b = ""; return $andy
Although it is object, it is still wrong, the format is not correct, so what on earth is this wsdl:types? after that, it is realized to try with map, and it is finally the result of the experiment.
$cardUID = array ('Result'= >' 100 minute description = > 'aaaaa'); return $cardUID
Grab the bag as follows
You can see 100s and aaaaa.
In this way, the actual format of soap is also at a glance, just to simply implement a few interfaces, using string assembly and parsing can be completed.
This is the end of the article on "how to build the actual message format of SOAP". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.