Java Web服务:在简单应用程序中使用生成的客户端代码获取HTTP 400

Java Web服务:在简单应用程序中使用生成的客户端代码获取HTTP 400,java,web-services,swing,Java,Web Services,Swing,场景 我在.NET(WCF)中创建了web服务,我必须为客户端应用程序使用JavaSwing 环境 Netbeans 7.2 JAVA代码: BookingService service; List<Booking> bookings; /** * Creates new form Home */ public Home() { initComponents(); service = new Booking

场景

我在.NET(WCF)中创建了web服务,我必须为客户端应用程序使用JavaSwing

环境

Netbeans 7.2

JAVA代码:

BookingService service;
    List<Booking> bookings;

    /**
     * Creates new form Home
     */
    public Home() {
        initComponents();
        service = new BookingService();
        refresh();
    }

    private void refresh() {
        DefaultTableModel model = (DefaultTableModel)grid.getModel();
        model.setRowCount(0);

        bookings = getAll().getBooking(); // breaks at this line
        if (bookings != null && !bookings.isEmpty()) {
            grid.getColumnModel().getColumn(0).setMinWidth(50);
            grid.getColumnModel().getColumn(0).setMaxWidth(50);
            grid.getColumnModel().getColumn(1).setMinWidth(150);
            grid.getColumnModel().getColumn(1).setMaxWidth(150);
            for (int i = 0; i < bookings.size(); i++) {
                Booking item = bookings.get(i);
                Object[] rowData = new Object[] {
                    item.getId(),
                    item.getCustomerId(),
                    item.getActivityId(),
                    item.getBookingDate(),
                    item.getStartTime(),
                    item.getEndTime()
                };
                model.addRow(rowData);
            }
        }
    }

//etc

private static ArrayOfBooking getAll() {
        racquetandhealthclient.services.bookings.BookingService service = new racquetandhealthclient.services.bookings.BookingService();
        racquetandhealthclient.services.bookings.IBookingService port = service.getWSHttpBindingIBookingService();
        return port.getAll();
    }
ant -f C:\\Users\\Matt\\Documents\\NetBeansProjects\\RacquetAndHealthClient -Ddebug.class=racquetandhealthclient.Program debug
init:
Deleting: C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\built-jar.properties
wsimport-init:
wsimport-client-activities:
files are up to date
wsimport-client-bookings:
files are up to date
wsimport-client-charge-accounts:
files are up to date
wsimport-client-countries:
files are up to date
wsimport-client-customers:
files are up to date
wsimport-client-invoices:
files are up to date
wsimport-client-generate:
compile:
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}SymmetricBinding" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Trust10" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Wss11" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing" was evaluated as "UNKNOWN".

//ETC.... same as above lines about 30 times... then:

Exception in thread "AWT-EventQueue-0" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:278)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:123)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
    at $Proxy31.getAll(Unknown Source)
    at racquetandhealthclient.views.bookings.Home.getAll(Home.java:94)
    at racquetandhealthclient.views.bookings.Home.refresh(Home.java:35)
    at racquetandhealthclient.views.bookings.Home.<init>(Home.java:28)
    at racquetandhealthclient.Program$1.run(Program.java:38)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
debug:
BUILD SUCCESSFUL (total time: 1 minute 26 seconds)
预订服务;
列出预订情况;
/**
*创建新的表单主页
*/
公共住宅(){
初始化组件();
服务=新预订服务();
刷新();
}
私有无效刷新(){
DefaultTableModel=(DefaultTableModel)grid.getModel();
model.setRowCount(0);
bookings=getAll().getBooking();//在此行中断
if(bookings!=null&&!bookings.isEmpty()){
grid.getColumnModel().getColumn(0).setMinWidth(50);
grid.getColumnModel().getColumn(0.setMaxWidth(50);
grid.getColumnModel().getColumn(1).setMinWidth(150);
grid.getColumnModel().getColumn(1).setMaxWidth(150);
对于(int i=0;i
输出:

BookingService service;
    List<Booking> bookings;

    /**
     * Creates new form Home
     */
    public Home() {
        initComponents();
        service = new BookingService();
        refresh();
    }

    private void refresh() {
        DefaultTableModel model = (DefaultTableModel)grid.getModel();
        model.setRowCount(0);

        bookings = getAll().getBooking(); // breaks at this line
        if (bookings != null && !bookings.isEmpty()) {
            grid.getColumnModel().getColumn(0).setMinWidth(50);
            grid.getColumnModel().getColumn(0).setMaxWidth(50);
            grid.getColumnModel().getColumn(1).setMinWidth(150);
            grid.getColumnModel().getColumn(1).setMaxWidth(150);
            for (int i = 0; i < bookings.size(); i++) {
                Booking item = bookings.get(i);
                Object[] rowData = new Object[] {
                    item.getId(),
                    item.getCustomerId(),
                    item.getActivityId(),
                    item.getBookingDate(),
                    item.getStartTime(),
                    item.getEndTime()
                };
                model.addRow(rowData);
            }
        }
    }

//etc

private static ArrayOfBooking getAll() {
        racquetandhealthclient.services.bookings.BookingService service = new racquetandhealthclient.services.bookings.BookingService();
        racquetandhealthclient.services.bookings.IBookingService port = service.getWSHttpBindingIBookingService();
        return port.getAll();
    }
ant -f C:\\Users\\Matt\\Documents\\NetBeansProjects\\RacquetAndHealthClient -Ddebug.class=racquetandhealthclient.Program debug
init:
Deleting: C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\built-jar.properties
wsimport-init:
wsimport-client-activities:
files are up to date
wsimport-client-bookings:
files are up to date
wsimport-client-charge-accounts:
files are up to date
wsimport-client-countries:
files are up to date
wsimport-client-customers:
files are up to date
wsimport-client-invoices:
files are up to date
wsimport-client-generate:
compile:
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}SymmetricBinding" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Trust10" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Wss11" was evaluated as "UNKNOWN".
Mar 01, 2013 9:42:56 AM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]  selectAlternatives
WARNING: WSP0075: Policy assertion "{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing" was evaluated as "UNKNOWN".

//ETC.... same as above lines about 30 times... then:

Exception in thread "AWT-EventQueue-0" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:278)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:123)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
    at $Proxy31.getAll(Unknown Source)
    at racquetandhealthclient.views.bookings.Home.getAll(Home.java:94)
    at racquetandhealthclient.views.bookings.Home.refresh(Home.java:35)
    at racquetandhealthclient.views.bookings.Home.<init>(Home.java:28)
    at racquetandhealthclient.Program$1.run(Program.java:38)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:682)
    at java.awt.EventQueue$3.run(EventQueue.java:680)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
debug:
BUILD SUCCESSFUL (total time: 1 minute 26 seconds)
ant-fc:\\Users\\Matt\\Documents\\NetBeansProjects\\RacquetAndHealthClient-Ddebug.class=RacquetAndHealthClient.Program debug
初始化:
删除:C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\build-jar.properties
deps jar:
更新属性文件:C:\Users\Matt\Documents\NetBeansProjects\RacquetAndHealthClient\build\build-jar.properties
wsimport init:
wsimport客户端活动:
文件是最新的
wsimport客户端预订:
文件是最新的
wsimport客户端收费帐户:
文件是最新的
wsimport客户国:
文件是最新的
wsimport客户端客户:
文件是最新的
wsimport客户端发票:
文件是最新的
wsimport客户端生成:
汇编:
2013年3月1日上午9:42:56[com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]选择备选方案
警告:WSP0075:策略断言“{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}“对称绑定”被评估为“未知”。
2013年3月1日上午9:42:56[com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]选择备选方案
警告:WSP0075:策略断言“{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}“信任10”被评估为“未知”。
2013年3月1日上午9:42:56[com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]选择备选方案
警告:WSP0075:策略断言“{http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}Wss11“被评估为“未知”。
2013年3月1日上午9:42:56[com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector]选择备选方案
警告:WSP0075:策略断言“{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing”被评估为“未知”。
//等等。。。。与上面的行相同大约30次。。。然后:
线程“AWT-EventQueue-0”com.sun.xml.internal.ws.client.ClientTransportException中出现异常:服务器发送了HTTP状态代码400:错误请求
在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:278)上
在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)上
位于com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
在com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)上
位于com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:123)
位于com.sun.xml.internal.ws.api.pipe.Fiber.\uuuu-doRun(Fiber.java:626)
位于com.sun.xml.internal.ws.api.pipe.Fiber.\u-doRun(Fiber.java:585)
位于com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
位于com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
位于com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
位于com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:146)
位于com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
位于com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
位于com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:129)
位于$Proxy31.getAll(未知来源)
在racquetandhealthclient.views.bookings.Home.getAll(Home.java:94)
在racquetandhealthclient.views.bookings.Home.refresh(Home.java:35)
在racquetandhealthclient.views.bookings.Home.(Home.java:28)
在racquetandhealthclient.Program$1.run(Program.java:38)
在java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)中
位于java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
在java.awt.EventQueue.access$200(EventQueue.java:103)
在java.awt.EventQueue$3.run(EventQueue.java:682)
在java.awt.EventQueue$3.run(EventQueue.java:680)
位于java.security.AccessController.doPrivileged(本机方法)
位于java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
位于java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
位于java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
在java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)中
在java.awt.EventDispatchThre