2011-04-19 1 views
5

주어진 WSDL 파일에서 코드 생성 (클라이언트 스텁)을 위해 Axis2 1.5.1 (wsdl2java)을 사용하고 있습니다.
웹 서비스는 외부 응용 프로그램에서 제공합니다. 다음의 RemoteApplication0.xsdWSDL에서 코드를 생성하면 예외가 발생합니다.

<?xml version="1.0" encoding="utf-8"?> 
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility- 1.0.xsd" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"    
xmlns:tns="http://tempuri.org/" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"  
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:i0="http://schemas.microsoft.com/ws/2005/02/mex/bindings" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
name="service" targetNamespace="http://tempuri.org/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
<wsdl:types> 
<xsd:schema targetNamespace="http://tempuri.org/Imports"> 
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication0.xsd" /> 
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication1.xsd" /> 
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication2.xsd" /> 
<xsd:include schemaLocation="SampleApp.App.ApplicationManager.RemoteApplication3.xsd" /> 
</xsd:schema> 
</wsdl:types> 
... 
</wsdl:definition> 

함유량은 :

<?xml version="1.0" encoding="utf-8"?> 
<xs:schema xmlns:tns="http://schemas.microsoft.com/Message" 
elementFormDefault="qualified" 
targetNamespace="http://schemas.microsoft.com/Message" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
<xs:complexType name="MessageBody"> 
<xs:sequence> 
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" /> 
</xs:sequence> 
</xs:complexType> 
</xs:schema> 

커맨드 :

wsdl2java -ss -g -d adb -or -p com.sampleapp.ws.generated.client -uri SampleRemoteProcess.wsdl 

생성 처리가 예외를 야기한다.
스택 트레이스 :

Using AXIS2_HOME: C:\develop\axis2-1.5.1-bin\axis2-1.5.1\ 
Using JAVA_HOME: C:\Program Files\Java\jdk1.6.0_21 
Retrieving document at 'C:\temp\SampleRemoteProcess.wsdl'. 
Retrieving schema at 'SampleApp.App.ApplicationManager.RemoteApplication0.xsd', relative to 'file:/C:/temp/SampleRemoteProcess.wsdl'. 
Retrieving schema at 'SampleApp.App.ApplicationManager.RemoteApplication1.xsd', relative to 'file:/C:/temp/SampleRemoteProcess.wsdl'. 
Retrieving schema at 'SampleApp.App.ApplicationManager.RemoteApplication2.xsd', relative to 'file:/C:/temp/SampleRemoteProcess.wsdl'. 
Retrieving schema at 'SampleApp.App.ApplicationManager.RemoteApplication3.xsd', relative to 'file:/C:/temp/SampleRemoteProcess.wsdl'. 
[ERROR] org.apache.ws.commons.schema.XmlSchemaException: 

An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports, 
but has the target namespace http://schemas.microsoft.com/Message 
java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaException: 
An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports, but has the target namespace http://schemas.microsoft.com/Message 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1904) 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1927) 
at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1653) 
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:219) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:433) 
at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:144) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2319) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:413) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:402) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:346) 
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:107) 
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:147) 
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) 
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) 
Caused by: org.apache.ws.commons.schema.XmlSchemaException: 
An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports 
but has the target namespace http://schemas.microsoft.com/Message 
at org.apache.ws.commons.schema.SchemaBuilder$2.validate(SchemaBuilder.java:1679) 
at org.apache.ws.commons.schema.SchemaBuilder.setNamespaceAttributes(SchemaBuilder.java:369) 
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:134) 
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:445) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:368) 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1898) 
... 13 more 

Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL 
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:153) 
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) 
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) 
Caused by: org.apache.axis2.AxisFault: 
org.apache.ws.commons.schema.XmlSchemaException: 
An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports, 
but has the target namespace http://schemas.microsoft.com/Message 
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:396) 
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:107) 
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:147) 
... 2 more  

Caused by: java.lang.RuntimeException: 
org.apache.ws.commons.schema.XmlSchemaException: 
An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports, 
but has the target namespace http://schemas.microsoft.com/Message 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1904) 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1927) 
at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1653) 
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:219) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:433) 
at org.apache.axis2.description.WSDLToAxisServiceBuilder.getXMLSchema(WSDLToAxisServiceBuilder.java:144) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.copyExtensibleElements(WSDL11ToAxisServiceBuilder.java:2319) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:413) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.processTypes(WSDL11ToAxisServiceBuilder.java:402) 
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:346) 
... 4 more 

An included schema was announced to have the default target namespace 
or the target namespace http://tempuri.org/Imports, 
but has the target namespace http://schemas.microsoft.com/Message 
at org.apache.ws.commons.schema.SchemaBuilder$2.validate(SchemaBuilder.java:1679) 
at org.apache.ws.commons.schema.SchemaBuilder.setNamespaceAttributes(SchemaBuilder.java:369) 
at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:134) 
at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:445) 
at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:368) 
at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1898) 
... 13 more 

네임 스페이스의 문제가 보인다,하지만 난 그것을 해결하는 방법을 잘 모릅니다.
아무도 내게 힌트를 줄 수 있습니까!

답변

0

오류 메시지는 매우 구체적입니다. 다른 스키마에서 <include> 인 스키마는 항상 가져 오기 스키마와 동일한 대상 네임 스페이스를 가져야합니다. RemoteApplication0.xsd 파일에서 대상 네임 스페이스 http://schemas.microsoft.com/Messagehttp://tempuri.org/Imports으로 변경해야합니다.

+0

나는 이미 그것을 시도했다! 하지만 여전히 예외가 있습니다. 포함 된 스키마가 기본 대상 네임 스페이스 또는 대상 네임 스페이스 http://tempuri.org/Imports, 이 있다고 발표되었지만 대상 네임 스페이스가 http://tempuri.org/ – ak75

+0

입니다. 그래서? 이것은 같은 오류입니다. 'http : // tempuri.org/Imports', __not__'http : // tempuri.org' 또는 유사한 것을 제공해야합니다. – musiKk

+0

'http : // tempuri.org/Imports'를 사용했습니다! 그러나 예외 메시지는'http : // tempuri.org /'입니다. 나는 완전히 혼란스러워! – ak75

3

문제는 "포함"을 사용하는 것입니다. "include"스키마는 과 동일한 대상 네임 스페이스가 포함되어있는 스키마 (반드시 네임 스페이스를 여러 파일로 분할하고 있음)로 있어야합니다. 대상 네임 스페이스가있는 다른 스키마 파일을 사용하도록 스키마를 "가져와야"합니다.