Home >Backend Development >PHP Tutorial >php5.3 webservices 开发 急急

php5.3 webservices 开发 急急

WBOY
WBOYOriginal
2016-06-23 14:05:581109browse

之前借助nusoap开发webservices,但好像在php 5.3中老报错,好像不支持,请问大家有没有php5.3开发的相关实例,或者支持5.3的nusoap插件,邮箱cxh741@163.com谢谢


回复讨论(解决方案)

把报的错发上来

把报的错发上来
我写服务端接口在5.2上正常(php/java调用都没问题),到5.3上调用不通,php调用页面空白,java调用错误如下

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:57)	{http://xml.apache.org/axis/}hostname:luoleiorg.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:57)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

又来了?5.3上php能调吗?

又来了?5.3上php能调吗?
对吖,亲,这个问题纠结死啦。这都几天了,我一直在搞这个问题,现在就是php 5.3.8版本上有问题,我估计就是版本问题导致的,nusoap插件不支持5.3以上吧,我的本地环境是 5.2.4的,是可以的

php5.2 起就提供了 php_soap 扩展,机器码的效率肯定要高于脚本,应优先选用
只不过到目前为止,还没有提供 WSDL 书写工具

nusoap 起源于 php4 限于开发者的能力,或多或少会存在问题。尤其是高版本的 php 语法上做了很多调整,如果你没有注意到,或没有精力去调整代码。则必然带来很多麻烦

php5.2 起就提供了 php_soap 扩展,机器码的效率肯定要高于脚本,应优先选用
只不过到目前为止,还没有提供 WSDL 书写工具

nusoap 起源于 php4 限于开发者的能力,或多或少会存在问题。尤其是高版本的 php 语法上做了很多调整,如果你没有注意到,或没有精力去调整代码。则必然带来很多麻烦
是啊,我也看了一篇关于webservices php5.3之后的开发实例,是要自己通过工具生成wsdl文件,就是那样改动太大了,还要有很大的调整,纠结吖

但你的服务已然形成,wsdl文件也没有修改的必要。更不要说创建了

调用接口报这个错是什么错哩

Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode:  faultString: org.xml.sax.SAXParseException: The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace bindings may not be empty. faultActor:  faultNode:  faultDetail: 	{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace bindings may not be empty.	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:526)	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:277)	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:57)	{http://xml.apache.org/axis/}hostname:luoleiorg.xml.sax.SAXParseException: The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace bindings may not be empty.	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:57)Caused by: org.xml.sax.SAXParseException: The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace bindings may not be empty.	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(XMLNSDocumentScannerImpl.java:526)	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:277)	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

有可能是环境配置问题 

有可能是环境配置问题 java的环境吗,这个环境调用过别的接口,可以掉通的

调用接口报这个错是什么错哩
Java code?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374Exception in thread "ma……

The value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is invalid. Prefixed namespace bindings may not be empty.

看下这行错误,你确定你调用方法没错?参数都传对了?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn