参考资料:

用java调用.net的wcf其实还是很简单的

wcf客户端调试工具的使用

利用wsdl2java工具生成webservice的客户端代码

生成webservice客户端的一些坑

java调用WCF服务

 

一、wsimport生成

cmd命令示例:

wsimport -encoding utf-8  -s  D:\Temp\TempCode  -p com.wcf.proxy http://192.168.80.194:9191/UTPWService/metadata

上述命令报错及解决方法:

1、[ERROR] 属性 "Any" 已定义。请使用 <jaxb:property> 解决此冲突。

Java调用.NET的WCF服务

解决方法:

1)创建xsd.xjb文件(创建txt文档,将下面内容复制进去,再更改文件名称问xsd.xjb)

<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
          version="2.0">
 
  <globalBindings>
    <xjc:simple />
  </globalBindings>
 
  <bindings scd="~xsd:complexType">
    <class name="ComplexTypeType"/>
  </bindings>
 
  <bindings scd="~xsd:simpleType">
    <class name="SimpleTypeType"/>
  </bindings>
 
  <bindings scd="~xsd:group">
    <class name="GroupType"/>
  </bindings>
 
  <bindings scd="~xsd:attributeGroup">
    <class name="AttributeGroupType"/>
  </bindings>
 
  <bindings scd="~xsd:element">
    <class name="ElementType"/>
  </bindings>
 
  <bindings scd="~xsd:attribute">
    <class name="attributeType"/>
  </bindings>
</bindings>
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-10-25
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案