访问Java Webservice时出现ColdFusion错误 [英] Coldfusion error while accessing Java webservice

查看:353
本文介绍了访问Java Webservice时出现ColdFusion错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Java-AXIs2 webservice,它返回一个java对象(用户定义的类)。我尝试使用此

 < cfset wsObj = createobject(webservice,http:// localhost:8080 / FFMpegHelperServices / services / TranscodeVideoFileFactoryWS?wsdl)> 



当我尝试访问此wsObj并执行某些操作时,会收到以下错误

 无法执行Web服务调用getTranscodeVideoFile。调用Web服务操作时返回的错误是:< br> < pre> AxisFault faultCode:{http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode:faultString:org.xml.sax.SAXException:No deserializer for {http://www.w3。 org / 2001 / XMLSchema} anyType faultActor:faultNode:faultDetail:{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:No deserializer for {http://www.w3.org / 2001 / XMLSchema} anytype在org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:314)在org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)在org.apache .axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)在org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)在org.apache.axis.message.RPCElement.deserialize(RPCElement.java :236)在org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)在org.apache.axis.client.Call.invoke(Call.java:2448)在org.apache.axis.client。 Call.invoke(Call.java:2347)at org.apache.axis.clien ...''< / pre> < br>错误发生在第34行。

任何人都有想法来处理这个问题。



webservice类看起来像这样

  public class TranscodeVideoFileFactoryWS {

private TranscodeVideoFile [] temp = new TranscodeVideoFile [1];

public String getTranscodeVideoFile(){
returnnasir;
}

}

解决方案

问题的关键在于隐藏在错误的这一部分:

 没有用于
的解串器

're try to consume is working with custom datatypes;有一个非常好的机会,webservice要么需要一个参数...或返回一个值是一种类型的变量CF不明白(比如,自定义类)。



不过,要解决此问题,您需要深入了解网络服务的内容,并确定您是否可以在您的网站上实施这些自定义类型。



- 编辑 -



根据注释中对Java类的描述,当初始化时, instatiated:

  private TranscodeVideoFile [] temp = new TranscodeVideoFile [1]; 

,而不是与您的方法调用直接相关, 你的初始CreateObject()的一部分,因此,正试图让我维持在一些能力在随后的对象调用。不幸的是,这个类是CF的自定义和未知的,如果你继续下去这个开发路径,会产生一个解串器错误。



有一个解决方案...但还有


$ b

解决方案

编译的类到webservice存根目录 ,这使ColdFusion知道它们,以便当你调用webservice上的方法时,ColdFusion知道如何处理类,并适当地序列化/反序列化它们。



我使用这个过程几个月,同时使用Netsuite API,信用:Jeremy Gibbens。你还想对ColdFusion工具进行一些研究,该工具允许生成stubs ad-hoc - 该工具是wsdl2java。



关于Wsdl2Java的日期文章,但相关仍然如此。



正确的操作



如果可以,不要使用基于SOAP的自定义类型。如果你有控制包装FFMpeg Helper对象的代码,并且对服务本身作出贡献 - 不要写任何处理自定义类的代码。使用ColdFusion能够理解的类型。



ColdFusion兼容的数据类型用于Web服务


I created one Java-AXIs2 webservice which returns a java object (user defined class). The I try to access it on coldfusion using this

<cfset wsObj=createobject("webservice","http://localhost:8080/FFMpegHelperServices/services/TranscodeVideoFileFactoryWS?wsdl")>

When I try to access this wsObj and do some operations, I get the following error

Cannot perform web service invocation getTranscodeVideoFile. The fault returned when invoking the web service operation is:<br> <pre>AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:314) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2448) at org.apache.axis.client.Call.invoke(Call.java:2347) at org.apache.axis.clien... ''</pre> <br>The error occurred on line 34. 

Any one has any idea hopw to handle this.

The webservice class looks like this

public class TranscodeVideoFileFactoryWS {

    private TranscodeVideoFile[] temp = new TranscodeVideoFile[1];

    public String getTranscodeVideoFile() {
        return "nasir";
    }

}

I want to access that class being returned.

解决方案

The key to your issue lies hidden within this portion of the error:

No deserializer for

The webservice you're trying to consume is working with custom datatypes; there is a very good chance that the webservice either requires an argument...or returns a value...which is a type of variable that CF does not understand (say, a custom Class).

Unfortunately, to resolve this issue, you'll have to dig a bit deeper into the guts of the webservice, and find out if you can implement those custom types on your end.

-- edit --

Based on the description of your Java Class in the comment, when it is initialized, a private var is instatiated:

private TranscodeVideoFile[] temp = new TranscodeVideoFile[1];

while not directly related to your method call, it is being created as a part your initial CreateObject(), and therefore, is attempting to me maintained in some capacity in the object calls that follow. Unfortunately, that Class is custom and unknown to CF, and will generate a deserializer error if you continue down this development path.

There's a solution...but there is also a "Right Thing" to do in this case.

Solution

Add the compiled classes to the webservice stubs directory by hand, which makes ColdFusion aware of them, so that when you invoke methods on the webservice, ColdFusion knows how to handle the classes, and serialize/deserialize them appropriately.

I used this process a few month while working with the Netsuite API, credit: Jeremy Gibbens. You'll also want to do some research on the ColdFusion tool that allows to produce stubs ad-hoc--the tool is wsdl2java.

Dated article on Wsdl2Java, but relevant nonetheless.

The "Right Thing"

If you can, don't work with custom types over SOAP. If you have control of the code that wraps the FFMpeg Helper objects, and are contributing to the service itself--don't write any code that deals with custom classes. Work with the types that ColdFusion understands.

ColdFusion-compatible datatypes for use in Web Services.

这篇关于访问Java Webservice时出现ColdFusion错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆