Phpwebservices-php Tutorial

Source: Internet
Author: User
For phpwebservices problems, I used php to write the following webservices interface code:
 ConfigureWSDL ('ecshopping webservices', 'urn: wsdl '); $ server-> wsdl-> schemaTargetNamespace = 'urn: wsdl'; $ server-> register ('test ', // method name array ('name' => 'xsd: String'), // input parameters array ('Return '=> 'xsd: String ') // output parameters); function test ($ name) {$ f = fopen ("check_debug.txt", "a +"); fwrite ($ f, "char = ". charToGBK ($ name); fclose ($ f); return 'input string :'. charToGBK ($ name);} $ HTTP_RAW _ POST_DATA = isset ($ HTTP_RAW_POST_DATA )? $ HTTP_RAW_POST_DATA: ''; $ server-> service ($ HTTP_RAW_POST_DATA);?>

Call in java
Public class Test {/*** @ param args */public static void main (String [] args) throws Exception {String endpoint = "http: // 192.168.5.10: 8080/shopping2013/Dragon/Service. php "; Service service = new Service (); Call call Call = (Call) service. createCall (); // create a call object through the service // Set the URL call of the service. setTargetEndpointAddress (new java.net. URL (endpoint); String ret = null; call. setOperationName ("test"); ret = call. invoke (new String [] {new String ("I am a soldier ". getBytes (), "ISO-8859-1 ")}). toString (); System. out. println (new String (ret. getBytes ("ISO-8859-1"), "GBK "));}}


Php webservices are stored on the local machine (win7/xp). the following error occurs in linux:
Exception in thread "main" AxisFault
FaultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
FaultSubcode:
FaultString: org. xml. sax. SAXException: Bad envelope tag: br
FaultActor:
FaultNode:
FaultDetail:
{Http://xml.apache.org/axis/?stacktrace:org.xml.sax.saxexception: Bad envelope tag: br
At org. apache. axis. message. EnvelopeBuilder. startElement (EnvelopeBuilder. java: 71)
At org. apache. axis. encoding. DeserializationContext. startElement (DeserializationContext. java: 1048)
At com.sun.org. apache. xerces. internal. parsers. AbstractSAXParser. startElement (AbstractSAXParser. java: 501)
At com.sun.org. apache. xerces. internal. parsers. AbstractXMLDocumentParser. emptyElement (AbstractXMLDocumentParser. java: 179)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl. scanStartElement (XMLNSDocumentScannerImpl. java: 377)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl $ NSContentDriver. scanRootElementHook (XMLNSDocumentScannerImpl. java: 626)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentFragmentScannerImpl $ FragmentContentDriver. next (XMLDocumentFragmentScannerImpl. java: 3095)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentScannerImpl $ PrologDriver. next (XMLDocumentScannerImpl. java: 922)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentScannerImpl. next (XMLDocumentScannerImpl. java: 648)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl. next (XMLNSDocumentScannerImpl. java: 140)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentFragmentScannerImpl. scanDocument (XMLDocumentFragmentScannerImpl. java: 510)
At com.sun.org. apache. xerces. internal. parsers. XML11Configuration. parse (XML11Configuration. java: 807)
At com.sun.org. apache. xerces. internal. parsers. XML11Configuration. parse (XML11Configuration. java: 737)
At com.sun.org. apache. xerces. internal. parsers. XMLParser. parse (XMLParser. java: 107)
At com.sun.org. apache. xerces. internal. parsers. AbstractSAXParser. parse (AbstractSAXParser. java: 1205)
At com.sun.org. apache. xerces. internal. jaxp. SAXParserImpl $ JAXPSAXParser. parse (SAXParserImpl. java: 522)
At javax. xml. parsers. SAXParser. parse (SAXParser. java: 395)
At org. apache. axis. encoding. DeserializationContext. parse (DeserializationContext. java: 227)
At org. apache. axis. SOAPPart. getAsSOAPEnvelope (SOAPPart. java: 696)
At org. apache. axis. Message. getSOAPEnvelope (Message. java: 435)
At org. apache. axis. handlers. soap. MustUnderstandChecker. invoke (MustUnderstandChecker. java: 62)
At org. apache. axis. client. AxisClient. invoke (AxisClient. java: 206)
At org. apache. axis. client. Call. invokeEngine (Call. java: 2784)
At org. apache. axis. client. Call. invoke (Call. java: 2767)
At org. apache. axis. client. Call. invoke (Call. java: 2443)
At org. apache. axis. client. Call. invoke (Call. java: 2366)
At org. apache. axis. client. Call. invoke (Call. java: 1812)
At test. TestGoods. main (TestGoods. java: 53)

{Http://xml.apache.org/axis/?hostname:luolei

Org. xml. sax. SAXException: Bad envelope tag: br
At org. apache. axis. AxisFault. makeFault (AxisFault. java: 101)
At org. apache. axis. SOAPPart. getAsSOAPEnvelope (SOAPPart. java: 701)
At org. apache. axis. Message. getSOAPEnvelope (Message. java: 435)
At org. apache. axis. handlers. soap. MustUnderstandChecker. invoke (MustUnderstandChecker. java: 62)
At org. apache. axis. client. AxisClient. invoke (AxisClient. java: 206)
At org. apache. axis. client. Call. invokeEngine (Call. java: 2784)
At org. apache. axis. client. Call. invoke (Call. java: 2767)
At org. apache. axis. client. Call. invoke (Call. java: 2443)
At org. apache. axis. client. Call. invoke (Call. java: 2366)
At org. apache. axis. client. Call. invoke (Call. java: 1812)
At test. TestGoods. main (TestGoods. java: 53)
Caused by: org. xml. sax. SAXException: Bad envelope tag: br
At org. apache. axis. message. EnvelopeBuilder. startElement (EnvelopeBuilder. java: 71)
At org. apache. axis. encoding. DeserializationContext. startElement (DeserializationContext. java: 1048)
At com.sun.org. apache. xerces. internal. parsers. AbstractSAXParser. startElement (AbstractSAXParser. java: 501)
At com.sun.org. apache. xerces. internal. parsers. AbstractXMLDocumentParser. emptyElement (AbstractXMLDocumentParser. java: 179)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl. scanStartElement (XMLNSDocumentScannerImpl. java: 377)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl $ NSContentDriver. scanRootElementHook (XMLNSDocumentScannerImpl. java: 626)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentFragmentScannerImpl $ FragmentContentDriver. next (XMLDocumentFragmentScannerImpl. java: 3095)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentScannerImpl $ PrologDriver. next (XMLDocumentScannerImpl. java: 922)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentScannerImpl. next (XMLDocumentScannerImpl. java: 648)
At com.sun.org. apache. xerces. internal. impl. XMLNSDocumentScannerImpl. next (XMLNSDocumentScannerImpl. java: 140)
At com.sun.org. apache. xerces. internal. impl. XMLDocumentFragmentScannerImpl. scanDocument (XMLDocumentFragmentScannerImpl. java: 510)
At com.sun.org. apache. xerces. internal. parsers. XML11Configuration. parse (XML11Configuration. java: 807)
At com.sun.org. apache. xerces. internal. parsers. XML11Configuration. parse (XML11Configuration. java: 737)
At com.sun.org. apache. xerces. internal. parsers. XMLParser. parse (XMLParser. java: 107)
At com.sun.org. apache. xerces. internal. parsers. AbstractSAXParser. parse (AbstractSAXParser. java: 1205)
At com.sun.org. apache. xerces. internal. jaxp. SAXParserImpl $ JAXPSAXParser. parse (SAXParserImpl. java: 522)
At javax. xml. parsers. SAXParser. parse (SAXParser. java: 395)
At org. apache. axis. encoding. DeserializationContext. parse (DeserializationContext. java: 227)
At org. apache. axis. SOAPPart. getAsSOAPEnvelope (SOAPPart. java: 696)
... 9 more


Reply to discussion (solution)

If there is no problem in the local machine (win7/xp), it indicates that the program itself is correct.
It may be a linux configuration problem or other

What do you say about java errors?

If there is no problem in the local machine (win7/xp), it indicates that the program itself is correct.
It may be a linux configuration problem or other

What do you say about java errors?
Java error reporting is a common error. I just hope that the folks who have encountered the relevant errors will provide some solutions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.