Apache CXF, JAX-WS Problem bei Arrays - einfacher Server

downandout

Mitglied
Wie überträgt man vom Server in die Klasse Client die Arrays bzw. Listen?

Wenn ich im Server dann das Array, das übertragen werden müsste, abfrage kommen immer Exceptions.
int lässt sich aber übertragen...

Bei:
System.out.println("Products: " + client.getCustomerProducts(0)[0]);
(Klasse Client - einzelner Datensatz dient nur zum Test)
Passiert:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy32.getcustomers(Unknown Source)
at demo.hw.server.Client.main(Client.java:21)
Caused by: org.apache.cxf.binding.soap.SoapFault: Fault occurred while processing.
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
usw.




Server
Java:
package demo.hw.server;

import javax.jws.WebService;
import javax.xml.ws.Endpoint;

import at.ac.univie.swa.ist.customers.CustomerClient;


@WebService(endpointInterface = "demo.hw.server.InterfaceS",
            serviceName = "InterfaceS")
public class Server implements InterfaceS {

    CustomerClient neu = new CustomerClient();


    public int[] getcustomers(){
    	
     //getCustomers liefert eine Liste von Customers, von denen dann einzelne Attribute ausgegeben werden
     int[] ids=null;
    	 for(int i = 0; i<neu.getCustomers().getCostumer().size();i++)
        	  ids[i]=(neu.getCustomers().getCostumer().get(i).getId());
    return ids;
    }
    
    public String[] getCustomerProducts(int customerid){
    	String[] orders = null;

    	for(int y = 0; y < neu.getCustomers().getCostumer().get(customerid).getOrder().size();y++)
    		orders[y]=(neu.getCustomers().getCostumer().get(customerid).getOrder().get(y).getProduct());
    	
    	return orders;
    	
    }
    public int getCustomerNumOfOrders(int customerid){
    	int zaehler=0;
    	for(int y = 0; y < neu.getCustomers().getCostumer().get(customerid).getOrder().size();y++)
    		zaehler++;
    	return zaehler;
    }

    public static void main(String args[]){
    	System.out.println("Starting Server");
    	Server implementor = new Server();
    	String address = "http://localhost:9000/Server";
    	Endpoint.publish(address, implementor);
    }

}

Java:
package demo.hw.server;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class Client {

	
	
	public static void main(String args[]){
		
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
		factory.setServiceClass(InterfaceS.class);
		factory.setAddress("http://localhost:9000/Server");
		InterfaceS client = (InterfaceS) factory.create();
		
		System.out.println("Number of Orders: " + client.getCustomerNumOfOrders(0));
		
               // ----Fehler-------
		-->//System.out.println("Number of Orders: " + client.getCustomerProducts(0)[0]);
		
		
		
		
		System.exit(0); 
		
	}
	
	
}

Interface
Java:
package demo.hw.server;

import javax.jws.WebService;


@WebService
public interface InterfaceS {

    int getCustomerNumOfOrders(int customerid);
    String[] getCustomerProducts(int customerid);
    int[] getcustomers();


}

Her wer eine Ahnung warum, ich mit dem Client keine Arrays übertragen kann?
 

musiKk

Top Contributor
Du initialisierst Deine Array-Variablen mit [c]null[/c] und versuchst dann, Elemente zu belegen. Das geht nicht.

Java:
String[] orders = new String[gewünschteLängeDesArrays];
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
G apache httpClient Problem. Netzwerkprogrammierung 5
Kr0e Apache Mina Problem Netzwerkprogrammierung 2
1 Upload problem! org.apache.commons.net.ftp Netzwerkprogrammierung 3
I Apache http-client: Problem beim Proxyaufruf Netzwerkprogrammierung 2
D HTTP Apache-HttpClient/UNAVAILABLE (java 1.4) Netzwerkprogrammierung 18
Nuiton FTP Apache Commons: FTPClient und Sicherheit Netzwerkprogrammierung 9
N FTP FTP Client invalid IPv6 address (Apache Commons Net API) Netzwerkprogrammierung 6
D Apache Mina Serial: Error Netzwerkprogrammierung 2
M Apache HTTPClient Server log ausgeben ?! Netzwerkprogrammierung 3
N HTTP Apache 4.2.1 HttpClient 302 nach Login und auf den weiteren Seiten. Netzwerkprogrammierung 5
R Apache HttpClient File Download? Netzwerkprogrammierung 3
0 Apache Commons File Object bekommen Netzwerkprogrammierung 4
W HTTP Apache HttpComponents und GZIP Netzwerkprogrammierung 2
F Apache commons net SFTPClient Netzwerkprogrammierung 5
M Apache Solr doc & pdf Upload Netzwerkprogrammierung 8
M need org.apache.commons.httpclient.* Netzwerkprogrammierung 8
C apache commons net ftp bei upload unvollständig Netzwerkprogrammierung 3
R HTTP Apache HTTP Client: Request mit angehängter Datei Netzwerkprogrammierung 2
R Apache Mina - Hilfestellung Netzwerkprogrammierung 32
D Apache Mina und GWT Servlet Netzwerkprogrammierung 4
N SFTP apache keine Verbindungaufbau möglich Netzwerkprogrammierung 6
K Login via apache httpclient Netzwerkprogrammierung 4
dayaftereh Fragen zu Apache Mina? Netzwerkprogrammierung 5
T HTTP Apache Commons HttpClient Bibliothek Netzwerkprogrammierung 2
Kr0e Apache Mina -> await() Netzwerkprogrammierung 30
B Tomcat Apache Server Netzwerkprogrammierung 6
lordcarlos HTTP Apache HttpClient, post und login. Netzwerkprogrammierung 2
J org.apache.http.auth.NTCredentials Netzwerkprogrammierung 2
A org.apache.commons http client in Netbeans einbinden Netzwerkprogrammierung 3
T Apache HttpClient & Default Headers Netzwerkprogrammierung 9
T apache HTTPClient einloggen Netzwerkprogrammierung 2
G apache von außen zugänglich machen Netzwerkprogrammierung 5
Q HTTPS mit Apache HttpClient Netzwerkprogrammierung 4
S Google Search Webservice mit Apache Axis realisieren? Netzwerkprogrammierung 2
S Applet und JWS auf Apache-Axis (SOAP) Netzwerkprogrammierung 8
C HTTPS mit Apache HTTPClient Netzwerkprogrammierung 1
M org.apache.commons.httpclient.HttpClient Netzwerkprogrammierung 3
J Antwort eines Soaprequests parsen mittels org.apache.soap Netzwerkprogrammierung 2
B Via Java Datei zu PHP-Script auf Apache hochladen Netzwerkprogrammierung 4
A http request per socket an apache server Netzwerkprogrammierung 5
I Socket Problem mit den WebSocket Antworten der Discord API Netzwerkprogrammierung 0
K Java Websocketserver Problem | Android to Pi Netzwerkprogrammierung 1
C RMI Produzent-Verbraucher-Problem - Code review Netzwerkprogrammierung 12
B Socket Bilder verschicken via Sockets. Heap-Problem. Netzwerkprogrammierung 2
S Problem bei dem Bluetoothverbindungsaufbau Netzwerkprogrammierung 2
G Server-Client IO Problem Netzwerkprogrammierung 6
M Netty - TCP Problem Netzwerkprogrammierung 4
L Socket Problem mit Server Netzwerkprogrammierung 1
J Chat Server starten über GUI problem Netzwerkprogrammierung 4
M Problem bei Socket (MultiplayerSpiel) Netzwerkprogrammierung 4
M Socket CDI, Websocket reference Problem ! Netzwerkprogrammierung 2
Shams Problem mit Eventbus in Verbindung mit Server Netzwerkprogrammierung 0
H Problem mit ObjectStreams Netzwerkprogrammierung 3
A Problem beim Senden von Client zu Server Netzwerkprogrammierung 10
D Socket BufferedWriter/Reader Problem Netzwerkprogrammierung 1
Maxim6394 Problem mit Socks5 Implementierung Netzwerkprogrammierung 0
C Handle Connection Problem Netzwerkprogrammierung 3
E HttpUrlConnection Cookie Problem Netzwerkprogrammierung 0
X Problem mit vielen Bytes über Socket Netzwerkprogrammierung 23
O 4Gewinnt Multiplayer - Netzwerk Problem (TCP) Netzwerkprogrammierung 1
A Socket Socket-Problem - Object wird nicht übertragen Netzwerkprogrammierung 3
R Problem beim Programmieren eines Chatprogramms Netzwerkprogrammierung 5
E einfaches Problem: Session-Handling bei Servlets Netzwerkprogrammierung 5
G Problem mit einem FileWatcher Netzwerkprogrammierung 7
T Socket Server starten Thread Problem Netzwerkprogrammierung 12
B Client/Server Connection Problem Netzwerkprogrammierung 2
G Problem mit STATIC-Verständnis Netzwerkprogrammierung 8
S Umstellung AS400 auf Postgre - Problem beim Arbeiten mit Metadaten Netzwerkprogrammierung 2
J Facelets Include Rendered Problem Netzwerkprogrammierung 2
J Socket Problem mit C++/Java Netzwerkprogrammierung 20
P Problem mit Datagram-Sockets Netzwerkprogrammierung 2
G Socket NIO2 Problem mit AsynchronousSocketChannel beim Schließen Netzwerkprogrammierung 3
G Cookie Verwaltungs Problem nach Login auf InetSeite (Wo utma-Cookie?) Netzwerkprogrammierung 18
C Socket Problem mit ObjectInput/OutputSream Netzwerkprogrammierung 7
B Socket Problem mit Netzwerkchat Netzwerkprogrammierung 21
D RMI Problem beim shutdown von verteilter CORBA-Anwendung Netzwerkprogrammierung 6
Maxim6394 ipv6 Problem Netzwerkprogrammierung 2
Maxim6394 Proxyserver Performance Problem Netzwerkprogrammierung 11
M Problem Client - Server Sockets: .ready() wird nie true! Netzwerkprogrammierung 6
C Socket Problem mit ObjectInput/OutputSream Netzwerkprogrammierung 5
B RMI und Problem mit rmic-Tool Netzwerkprogrammierung 3
C FTP storeFileStream Problem Netzwerkprogrammierung 3
N Problem über http eine Datei zu senden Netzwerkprogrammierung 4
D JavaMail - Mailsabrufen Problem (imap) Netzwerkprogrammierung 12
J HTTP Übersetzung yahoo babelfish - Zeichensatz-Problem Netzwerkprogrammierung 6
M Problem beim Datenempfang Netzwerkprogrammierung 2
X Problem mit Server-Client-Kommunikation Netzwerkprogrammierung 14
M Problem mit Socket-Verbindung Netzwerkprogrammierung 2
N NIO Problem beim speziellen Behandeln von einzelnen Benutzern Netzwerkprogrammierung 13
D Thread problem Netzwerkprogrammierung 3
T Servlets JSP: Tomcat Problem Netzwerkprogrammierung 4
K Client - Server Problem Netzwerkprogrammierung 16
T RMI Problem Client-Server Netzwerkprogrammierung 2
P RMI Stub Problem Netzwerkprogrammierung 3
D Socket UDP Übertragungs Problem Netzwerkprogrammierung 7
I HTTP Post aus html in Java einlesen - Problem Netzwerkprogrammierung 2
I HTTP Post aus html in Java einlesen - Problem Netzwerkprogrammierung 6
D Problem mit ObjectInputStreams Netzwerkprogrammierung 10
D Socket Problem mit InputStreamReader Netzwerkprogrammierung 3
N CRC32 CheckSum Problem bei UDP Netzwerkprogrammierung 2

Ähnliche Java Themen

Neue Themen


Oben