현재 Dynamics CRM 4.0 웹 서비스로 작업하고 있습니다. 내가 한 첫 번째 일은 Java/JAX-WS
에 대한 wsimport를 사용하여 웹 서비스의 WSDL을 기반으로 올바른 클래스를 생성하는 것이 었습니다.WSImport가 여러 Dynamics CRM 4.0 WSDL의 충돌하는 XMLTypes를 생성합니다.
[ERROR] A class/interface with the same name
"com.microsoft.schemas.crm._2007.webservices.RetrieveResponse" is already in use. Use a class customization to resolve this conflict.
line 979 of file://src/main/webapp/WEB-INF/classes/META-INF/wsdl/CrmServiceWsdl.wsdl
[ERROR] (Relevant to above error) another "RetrieveResponse" is generated from here.
line 12274 of file://src/main/webapp/WEB-INF/classes/META-INF/wsdl/CrmServiceWsdl.wsdl
라인 979이 우리에게 알려줍니다 : 클래스를 생성하는 동안 나는 약간의 오류가있어
<s:element name="RetrieveResponse">
<s:complexType>
<s:sequence>
<s:element name="RetrieveResult" type="s3:BusinessEntity" />
</s:sequence>
</s:complexType>
</s:element>
그리고 라인 12,274 것은 우리에게 제공합니다
<s:complexType name="RetrieveResponse">
<s:complexContent mixed="false">
<s:extension base="tns:Response">
<s:sequence>
<s:element ref="s3:BusinessEntity" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
두 부분 모두가 같은 네임 스페이스에 있습니다. 둘 다 RetrieveResponse.class로 생성되어 충돌합니다. 나는 JAX-B 바인딩 XML 파일이 문제에 대한 해결책을 발견했습니다 :이 작동
<bindings node="//xsd:complexType[@name='RetrieveResponse']">
<jaxb:class name="RetrieveResponseType"/>
</bindings>
을 (확실하지 않은이 올바른 접근 방식 인 경우 ..?) ..이 후 그래서
, 나는 성공적으로 webservice에 대한 호출을 성공적으로 만들었습니다.
다이나믹스 CRM의 일부 비즈니스 엔티티는 픽리스트을 사용합니다. 이 유형의 엔티티는 메타 데이터 서비스로 질의 할 수 있습니다. http://msdn.microsoft.com/en-us/library/bb890248.aspx
다음으로 내가 한 일은 WSDL을 기반으로 메타 데이터 서비스의 클래스를 생성하는 것입니다. 생성 된 클래스의 결과는 예외는 아닙니다. 예를 들어 'com.microsoft.schemas.crm._2007.webservices.ExecuteResponse'클래스를 생성합니다. 그러나이 클래스는 CrmService 생성 클래스와 완전히 동일한 패키지에도 있습니다. 2의 차이점은 다음과
Metadataservice ExecuteReponse :
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"response"
})
@XmlRootElement(name = "ExecuteResponse")
public class ExecuteResponse {
@XmlElement(name = "Response")
protected MetadataServiceResponse response;
etc...
CrmService ExecuteReponse :
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"response"
})
@XmlRootElement(name = "ExecuteResponse")
public class ExecuteResponse {
@XmlElement(name = "Response", required = true)
protected ResponseType response;
etc...
지금이 클래스는 단지 하나의 일례 인 있다 (다른 예 CrmAuthenticationToken이다) 거의 다른 클래스의 정확한 중복. 동일한 클래스를 사용할 수 있도록 CrmService 클래스에 패키지 접미사를 추가했습니다 (접두어으로 표시됨).
Two classes have the same XML type name "{http://schemas.microsoft.com/crm/2007/CoreTypes}CrmAuthenticationToken". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.microsoft.schemas.crm._2007.coretypes.CrmAuthenticationToken
at public com.microsoft.schemas.crm._2007.coretypes.CrmAuthenticationToken *prefix*.com.microsoft.schemas.crm._2007.coretypes.ObjectFactory.createCrmAuthenticationToken()
at *prefix*.com.microsoft.schemas.crm._2007.coretypes.ObjectFactory
this problem is related to the following location:
at *prefix*.com.microsoft.schemas.crm._2007.coretypes.CrmAuthenticationToken
at public javax.xml.bind.JAXBElement *prefix*.com.microsoft.schemas.crm._2007.webservices.ObjectFactory.createCrmAuthenticationToken(*prefix*.com.microsoft.schemas.crm._2007.coretypes.CrmAuthenticationToken)
at *prefix*.com.microsoft.schemas.crm._2007.webservices.ObjectFactory
내가 개인적으로는 동일한 패키지 구조에 같은 이름을 가진 다른 클래스를 넣어 이상한 생각 : 나는 CrmService를 호출 할 때 은 그래서 지금, 나는 다음과 같은 예외를 얻을. 이것은 당신이 동시에 2 개의 웹 서비스를 사용할 수 없다는 것을 의미합니다 ..
이것은 마이크로 소프트, WSimport 버그입니까, 아니면 제 마지막으로 어리석은 실수입니까? 누군가가이 문제를 도와 줄 수 있기를 바랍니다.
시간 내 주셔서 감사합니다.