One: first to publish a Web service
Package Com.ws.service;public Interface Iuserservice{public string GetUserName (string id);}
Package Com.ws.service;import Javax.jws.webmethod;import Javax.jws.webparam;import javax.jws.webservice;@ Webservicepublic class UserService implements iuserservice{@WebMethodpublic String getusername (@WebParam (name= "id") String ID) {return "User:" + ID;}}
Package Com.ws.service;import Javax.xml.ws.endpoint;public class Server{public static void Main (string[] args) { Endpoint.publish ("Http://0.0.0.0:6633/api/v1/user", New UserService ()); System.out.println ("WS Startup OK on port" + 6633);}}
The port for WS is 6633
Access address is: HTTP://192.168.100.95:6633/API/V1/USER?WSDL
Then, the Nginx configuration is as follows:
Upstream WebService {server 192.168.10.95:6633;} server { listen 6633; Location/{Proxy_pass http://webservice;}}
The Nginx address is: 192.168.2.123
Then Access Proxy address: http://192.168.2.123:6633/api/v1/user?wsdl
The results are as follows
The address here is obviously wrong.
Here's how to fix it
The Nginx configuration changes to:
Upstream WebService {server 192.168.100.95:6633;} server { listen 6633; Location/{ Proxy_set_header Host $host: $server _port;proxy_pass http://webservice;}}
The reason is that if there is no configuration
Proxy_set_header Host $host: $server _port;
Then, Nginx reverse proxy to the background, pass the host HTTP header for
Host=webservice
The above describes the solution of the Nginx Response Agent Web Service soap:address location problem, including the content, I hope that the PHP tutorial interested in a friend helpful.