如何将枚举值传递给Genexus 15中包含的Web服务?

时间:2019-02-26 02:03:15

标签: java jax-ws genexus

我无法使用以C#完成的具有enum属性和DateTime属性的Web服务。在Genexus 15中,使用Java Generator,“ JAX-Ws”用于生成“ SOAP Native” Web服务。 导入wsdl不会失败。但是,在发送请求时,程序会给出以下错误消息:

request: 
  <Route xmlns="http://www.jfdkfjdkfjkd.com.br/">
  <Id>0</Id>
  <Name>fdfd 2387</Name>
  <IssuerId>434343</IssuerId>
  <OriginCityId>1302603</OriginCityId>
  <DestinationCityId>50308</DestinationCityId>
  <Modal>Road</Modal>
  </Route>

“模式”属性为枚举类型:道路,飞机,火车,其他

导入wsdl不会失败。但是,在发送请求时,程序会给出以下错误消息:

No error.SOAP Fault: Error in client request.
Message: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (11, 13). ---> System.InvalidOperationException: Instance validation error: '' is not a valid value for ModalTypes.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_ModalTypes(String s)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read11_Route(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read35_CreateRoute()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer40.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Detail: (-20004)

在这种情况下,如何通过Web服务发送枚举属性?有什么方法可以在Genexus或wsdl中手动配置JaxB?

对于DateTime属性,其错误如下:

Detail: SOAP Fault: Error in client request.
Message: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (12, 17). ---> System.FormatException: The string '
' is not a valid AllXsd value.
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read14_Tracking(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read39_CreateTracking()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer48.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Detail: SOAP Fault: Error in client request.
Message: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (12, 17). ---> System.FormatException: The string '
' is not a valid AllXsd value.
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read14_Tracking(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read39_CreateTracking()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer48.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Detail: (-20004)

谢谢您的帮助。

目前为止

1 个答案:

答案 0 :(得分:-1)

您可以在Genexus中定义枚举值,但是我不知道这是否足够 您知道如何以正确的方式传递模态值吗? 它的意思是:    路 这是不正确的。正确的是什么? 您可以使用SOAP ui或类似的工具尝试Web服务吗?