How to add external network using vSphere API - vmware

I want to add external network using vSphere API but didn't got any idea.
Please give me links.

Kindly check vSphere API documentation for details and procedures
There is an API service method:: AddVirtualNIC
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vim25="urn:vim25" name="AddVirtualNic" type="vim25:AddVirtualNicRequestType"/>
<element xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vim25="urn:vim25" name="AddVirtualNicResponse">
<complexType>
<sequence>
<element name="returnval" type="xsd:string"/>
</sequence>
</complexType>
</element>
Proceed further with configuration details on vSphere HostNetworkSystem <ManagedOBJECT>

Related

Soap service call from a class library is failing when I call the class library. Works in a console app

I am creating a event handler in MS Project Server. This event handler is calling a class library (dll file). The event handler is set and triggered from within the MS Project by clicks and not by code. In this class library, I am having a service reference to a web service. But, whenever, the event is triggered, I see the following error when I debug the class library via 'Attach to Process' option:
Could not find default endpoint element that references contract 'PSS.Project.ProjectSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Here is what my app.config looks like:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="basicHttpBehavior">
<clientCredentials>
<windows allowedImpersonationLevel="Impersonation" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpConf" sendTimeout="01:00:00" maxBufferSize="500000000"
maxReceivedMessageSize="500000000">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="500000000" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="ProjectSoap">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcProject.Project"
name="basicHttp_Project" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcResource.Resource"
name="basicHttp_Resource" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/ProjectServer.svc"
behaviorConfiguration="basicHttpBehavior" binding="basicHttpBinding"
bindingConfiguration="basicHttpConf" contract="SvcStatusing.Statusing"
name="basicHttp_Statusing" />
<endpoint address="http://xxxx/pwa/_vti_bin/PSI/Project.asmx?wsdl"
binding="basicHttpBinding" bindingConfiguration="ProjectSoap"
contract="PSS.Project.ProjectSoap" name="ProjectSoap" />
</client>
</system.serviceModel>
</configuration>
I also confirmed that the URL: http://xxxx/pwa/_vti_bin/PSI/Project.asmx?wsdl is working.
In the cs file, the error appears on the following code:
ProjectSoapClient projectSvc = new ProjectSoapClient();
When I do the same thing in a console app, it works, but when use a class library, it fails. I have read some Q&A's here and I know that when I am calling a service reference from a class library, I need to include configuration files of the service reference into the the class library, but I am not quite sure how and where to bring the config files from in my case and what portion of app.config should I add it to.
I have been able to call a WCF service within a Project Server Event Receiver DLL.
In order to do so, please follow these "tricks":
1.- For configuracion purposes, the DLL's (you code) execute within the Microsoft.Office.Project.Server.Eventing.exe process, which is located (in a default configuration) on: "C:\Program Files\Microsoft Office Servers\14.0\Bin". For custom installs open the task manager and right click the "Microsoft.Office.Project.Server.Eventing.exe" and select go to file. So, any configuration you need to be written in a file needs to be put in that directory insede the file: "Microsoft.Office.Project.Server.Eventing.exe.config". I have used this file to put a Database Connection String and I've been able to read it with the System.Configuration library. However, not all configuration sections works, I tried to put appSettings and a Sharepoint error was raised.
2.- For interaction with the Project Servers PSI, please use the WCF interface instead of the ASMX interface (I don't know why, but it works much better). I suggest using WCF programmatically (a quick search on google will net you how to set the bindings on the code).
I hope this helps you, I assure you it works. Now I'm trying to call ASMX service within the DLL (I'm still on it, if I find something I'll post).

Change the name of the Request Element in XSD file of a Spring Web Service

I have a Web Service with a method called TestMethod.
On the XSD file I have this:
<element name="TestMethodResponse">
<complexType>
<sequence>
<element name="codRta" type="int" />
</sequence>
</complexType>
</element>
<element name="TestMethodRequest">
<complexType>
<sequence>
</sequence>
</complexType>
</element>
As you can see, there is a TestMethodRequest and TestMethodResponse
This work OK!
Now, I need to make some changes.
This Web Service will be used to replace another Web Service.
So I need to call the methods on my Web Service equal to the older one.
That because my client have a Desktop Application (using the older Web Service) working, and off course, dosen't want to change it.
My problem is with the WSDL of the older Web Service.
If you see the WSDL, the method "TestMethod" doesn't have a TestMethodRequest element. It have a "TestMethod" element (without the Request part).
It is posible to do that? How can I do?
How can I change the XSD to name the Request element "TestMethod" instead of "TestMethodRequest "?(and keep the Web Services working)
Thanks and sorry for my poor english

soapaction in WSDL using CXF

I am developing webservice using CXF. I use HTTP binding so according to http://www.w3.org/TR/wsdl#_soap:operation soapaction is mandatory for this type of transport.
The problem is that I want to deploy the same application for test and production server. I would like to do it without rebuilding application or keeping external WSDL files, which will add one more thing on maintenance list.
I had the same problem with location, but that one was trivial to solve. I used publishedEndpointUrl in endpoint configuration to set proper value. The value is retrieved during initialization of application from external property file, which I placed on classpath tomcat/common/classes .
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:ws.properties</value>
</list>
</property>
</bean>
<jaxws:endpoint xmlns:tns="http://example.org/ds" id="ds" implementor="org.example.Ds" wsdlLocation="wsdl/ds.wsdl" endpointName="tns:dsSOAP" serviceName="tns:Ds" address="/dsSOAP" publishedEndpointUrl="${publishedEndpointUrl}">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
</jaxws:endpoint>
</beans>
I would like to achieve the same functionality for soapaction. The value for this attribute should be not relative URI. So for test it should be:
<soap:operation soapAction="https://test.example.org/dsSOAP/operation1" />
and for production
<soap:operation soapAction="https://example.org/dsSOAP/operation1" />
any idea how to achieve this?
You dont need to specify an absolute URL, you dont need either to specify a URL. "operation1" would be enough. See some official examples at http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528
Linking the soap action with the environment the instance is running is not a "best practice".

How to quickly create a web-service for testing purposes?

I have to make a client for a web-service. The web-service is not ready yet. I want to make a web-service server with one mockup method. This method must take one parameter - a collection of objects. The only thing that I have for now is the xsd describing the data type for the web-service's method parameter. Here it is
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://localhost/1csite/Contractors" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://localhost/1csite/Contractors">
<xsd:complexType name="Contractor">
<xsd:sequence>
<xsd:element name="Code" type="xsd:string"/>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="ParentCode" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Contractors">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="Element" nillable="true" type="tns:Contractor"/>
</xsd:sequence>
</xsd:complexType>
How can I quickly make a web-service server with one method taking objects of this data type?
Thank you.
If I understand you correctly, you need a temporary server for a not yet complete web service, so you can build a client against the service. If that is the case, and you are comfortable with Linux, you can set up your own Apache web server and use the Apache Axis2 web services engine, along with your xsd file. Check out the quick start guide.

XSD, JaxWS, and Glassfish

I have a xsd with quite a few pattern restrictions in it and this xsd is used in our wsdl. When we deploy the ear to glassfish and bring up the wsdl and xsd in a browser all of our pattern restrictions are stripped out. Why? How can I eliminate the stripping of our restrictions.
Here is a snippet:
<xsd:complexType name="len">
<xsd:sequence>
<xsd:element name="value" type="tns:dms_len"/>
<xsd:element name="new_value" type="tns:dms_len" minOccurs="0"></xsd:element>
</xsd:sequence>
<xsd:attribute name="action" type="tns:update_actions"></xsd:attribute>
</xsd:complexType>
Here is what it looks like after it is deployed:
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT. -->
...
<xs:complexType name="len">
<xs:sequence>
<xs:element name="value" type="xs:string"></xs:element>
<xs:element name="new_value" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
<xs:attribute name="action" type="tns:update_actions"></xs:attribute>
</xs:complexType>
Notice how value and new_value are now just plain strings.
Update:
It seems this only happens when I deploy using netbeans, when I deploy from the glassfish console it the pattern restrictions are still there. Why netbeans?
Looks like glassfish does not recognize your xsd when deployed from NetBeans and generates its own.
So first of all, verify that the deployed version uses the correct xsd. Deploying from NetBeans utilizes directory deployment e.g. it does not deploy the ear file but the content in your project directory.