Hi, I'm new to CXF

I create a serie of java class following the user guide. Than I generate the
WSDL and from that WDSL I generate the client.
I use the simple Client I get and I modify it setting some parameter to the
request.
When the parameter arrived on the server I see they are null.
I surfed the net and I realize that the problem is on the
qualified/unqualified issue.
But I can't get a solution. I can't understand why it doesn't work, I follow
all the steps and the service is not working, can anyone help me please?

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.xyz.test.soap.test;

import java.net.URL;

import javax.xml.namespace.QName;

import com.xyz.test.soap.TestFileServiceResponse;
import com.xyz.test.soap.TestFileSoapService;
import com.xyz.test.soap.TestServiceEncoding;
import com.xyz.test.soap.TestServiceFormats;
import com.xyz.test.soap.TestSoap;
import com.xyz.test.soap.TestSoap_Service;
import com.xyz.test.soap.InvalidServiceCallException;


public final class Client {
        
    private static final QName SERVICE_NAME = new
QName("http://soap.test.xyz.com/";, "testSoap");

    private Client() {
    }

        public static void main(String args[]) throws Exception {

        URL wsdlLocation = new
URL("file:/C:/workspace/WsdlToCxf/wsdl/testsoap.wsdl");
        
        TestSoap_Service ss = new TestSoap_Service(wsdlLocation,
SERVICE_NAME);
        TestSoap port = ss.getSoapPort();  
        TestFileServiceResponse response; 
        
        TestFileSoapService dfss = new TestFileSoapService();
        dfss.setUser("test");
        dfss.setPassword("testpass");
        dfss.setEncoding(TestServiceEncoding.BASE_64);
        dfss.setFileName("testfile");
        dfss.setFormat(TestServiceFormats.TXT);
        dfss.setData("testodiprova".getBytes());
        
        try {
            System.out.println("Invoking sendFileToTest...");
            response = port.sendFileToTest(dfss);
            System.out.println("Server responded with code: " +
response.getCode());
            System.out.println("Server responded with message: " +
response.getCode());
            System.out.println();

        } catch (InvalidServiceCallException e) { 
            System.out.println("Expected exception:
InvalidServiceCallException has occurred.");
            System.out.println(e.toString());
        }



        System.exit(0); 
    }

}

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="testSoap"
targetNamespace="http://soap.test.xyz.com/";
xmlns:ns1="http://com/xyz/test/soap";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:tns="http://soap.test.xyz.com/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:tns="http://soap.test.xyz.com/"; attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://soap.test.xyz.com/";>
    <xs:complexType name="testFileSoapService">
        <xs:sequence>
            <xs:element minOccurs="0" name="user" type="xs:string"/>
            <xs:element minOccurs="0" name="password" type="xs:string"/>
            <xs:element minOccurs="0" name="format"
type="tns:testServiceFormats"/>
            <xs:element minOccurs="0" name="encoding"
type="tns:testServiceEncoding"/>
            <xs:element minOccurs="0" name="fileName" type="xs:string"/>
            <xs:element minOccurs="0" name="data" type="xs:base64Binary"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="testFileServiceResponse">
        <xs:sequence>
            <xs:element name="code" type="xs:int"/>
            <xs:element minOccurs="0" name="message" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:simpleType name="testServiceFormats">
        <xs:restriction base="xs:string">
            <xs:enumeration value="XML"/>
            <xs:enumeration value="TXT"/>
            <xs:enumeration value="PDF"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="testServiceEncoding">
        <xs:restriction base="xs:string">
            <xs:enumeration value="BASE64"/>
            <xs:enumeration value="UTF8"/>
            <xs:enumeration value="ISO88591"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element name="InvalidServiceCall" type="tns:InvalidServiceCall"/>
    <xs:complexType name="InvalidServiceCall">
        <xs:sequence>
            <xs:element name="error" nillable="true" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:ns0="http://soap.test.xyz.com/"; xmlns:tns="http://com/xyz/test/soap";
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://com/xyz/test/soap";>
    <xsd:element name="testFileSoapService" nillable="true"
type="ns0:testFileSoapService"/>
    <xsd:element name="testFileServiceResponse" nillable="true"
type="ns0:testFileServiceResponse"/>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="sendFileTotestResponse">
    <wsdl:part name="parameters" element="ns1:testFileServiceResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="sendFileTotest">
    <wsdl:part name="parameters" element="ns1:testFileSoapService">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="InvalidServiceCallException">
    <wsdl:part name="InvalidServiceCallException"
element="tns:InvalidServiceCall">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="testSoap">
    <wsdl:operation name="sendFileTotest">
      <wsdl:input name="sendFileTotest" message="tns:sendFileTotest">
    </wsdl:input>
      <wsdl:output name="sendFileTotestResponse"
message="tns:sendFileTotestResponse">
    </wsdl:output>
      <wsdl:fault name="InvalidServiceCallException"
message="tns:InvalidServiceCallException">
    </wsdl:fault>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="testSoapServiceServiceSoapBinding"
type="tns:testSoap">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="sendFileTotest">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="sendFileTotest">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="sendFileTotestResponse">
        <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="InvalidServiceCallException">
        <soap:fault name="InvalidServiceCallException" use="literal"/>
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="testSoap">
    <wsdl:port name="SoapPort"
binding="tns:testSoapServiceServiceSoapBinding">
      <soap:address location="http://localhost:9090/SoapPort"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

-- 
View this message in context: 
http://www.nabble.com/Null-parameter-in-request-and-response-tp20255751p20255751.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to