---
title: "cxf publish"
author: "openstudy"
date: "2011-09-08T19:31:37Z"
tags: []
categories: ["企业架构"]
slug: "cxf-publish"
draft: false
lastmod: "2011-09-08T20:41:15Z"
id: 1168782
url: "https://openstudy.iteye.com/blog/1168782"
---

Object implementor = new ImplPLMToArchiveWSSoap();
String address = "http://localhost:4931/soa";
Endpoint.publish(address, implementor);

http://localhost:4931/soa?wsdl（即Endpoint.publish的address+"?wsdl"）可以查看到wsdl

客户端访问
String check_key = "PLM-ARCHIVE";
String wsdl_url = "http://localhost:4931/soa?wsdl";
String namespace_url = "http://server.lantai.integration/";
String service_name = "ImplPLMToArchiveWSSoapService";

QName SERVICE_NAME = new QName(namespace_url, service_name);
//use Service.create to create Service instances
Service service = Service.create(wsdlURL, SERVICE_NAME);
PLMToArchiveWSSoap port = service.getPort(PLMToArchiveWSSoap.class);

这里重点介绍两个参数
1）namespace_url，wsdl:definitions中targetNamespace属性的值
2）service_name，wsdl:service中的name属性的值