package hwpoc;
import javax.jws.*; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService;
import javax.naming.Context; import javax.naming.InitialContext;
import java.io.*; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; import java.net.*;
import javax.net.ssl.HttpsURLConnection;
@WebService public class wlsOTMServices {
@WebMethod public String CallWebService(@WebParam(name = "arg0") String inputString) { String SOAPAction = "process"; StringBuffer outputString=new StringBuffer(""); System.out.println("===="+inputString); try { // Create the connection where we\'re going to send the file. //URL url = new URL("http://192.168.2.16:7001/pwsc/services/DataCenterService?wsdl"); //URL url = new URL("https://cn25762-test-cn25762.otm.us2.oraclecloud.com:443/GC3Services/IntXmlService/call?WSDL"); URL url = new URL(null, "https://cn25762-test-cn25762.otm.us2.oraclecloud.com:443/GC3Services/IntXmlService/call?WSDL", new sun.net.www.protocol.https.Handler()); //URLConnection connection = url.openConnection(); //HttpURLConnection httpConn = (HttpURLConnection) connection; HttpsURLConnection httpConn = (HttpsURLConnection)url.openConnection(); String envelop=(" <env:Envelope xmlns:env=\\"http://schemas.xmlsoap.org/soap/envelope/\\"><env:Header>\\n" + " <wsse:Security xmlns:wsse=\\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\\">\\n" + " <wsse:UsernameToken>\\n" + " <wsse:Username>XB.INTEGRATION_USER</wsse:Username>\\n" + " <wsse:Password Type=\\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\\">CHANGEME</wsse:Password>\\n" + " </wsse:UsernameToken>\\n" + " </wsse:Security>\\n" + " </env:Header>\\n" + " <env:Body>"); String enve1= ("</env:Body> </env:Envelope>"); inputString=envelop+inputString+enve1; System.out.println(inputString); // Set the appropriate HTTP parameters. httpConn.setRequestProperty( "Content-Length",String.valueOf(inputString.length())); httpConn.setRequestProperty("Content-Type","text/xml; charset=UTF-8"); httpConn.setRequestProperty("SOAPAction",SOAPAction); //httpConn.setRequestProperty("Accept-Encoding:","gzip,deflate"); httpConn.setRequestMethod( "POST" ); httpConn.setDoOutput(true); httpConn.setDoInput(true); // Everything\'s set up; send the XML that was read in to b. OutputStream out = httpConn.getOutputStream(); //out.write(envelop.getBytes()); out.write(inputString.getBytes()); //out.write(enve1.getBytes()); out.close(); // Read the response and write it to standard out. InputStreamReader isr = new InputStreamReader(httpConn.getInputStream()); BufferedReader in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) //System.out.println("****"+inputLine); outputString = outputString.append(inputLine); in.close(); } catch (Exception e) { System.out.println(e.toString()); } String aa = outputString.toString(); return aa;
}
@WebMethod(exclude = true) public static void main(String[] args) { wlsOTMServices test = new wlsOTMServices(); String inputString = "<Transmission>\\n" + " <TransmissionHeader>\\n" + " <UserName>HWPOC.INTEGRATION_USER</UserName>\\n" + " <Password>******</Password>\\n" + " <SenderSystemId/>\\n" + " <GlogXMLElementName/>\\n" + " </TransmissionHeader>\\n" + " <TransmissionBody>\\n" + " <GLogXMLElement>\\n" + " <Release>\\n" + " <ReleaseGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>000032160036AHHWA04K</Xid>\\n" + " </Gid>\\n" + " </ReleaseGid>\\n" + " <TransactionCode>IU</TransactionCode>\\n" + " <ReleaseHeader>\\n" + " <ReleaseMethodGid>\\n" + " <Gid>\\n" + " <Xid>AUTO_CALC</Xid>\\n" + " </Gid>\\n" + " </ReleaseMethodGid>\\n" + " <CommercialTerms>\\n" + " <IncoTermGid>\\n" + " <Gid>\\n" + " <Xid>DDU</Xid>\\n" + " </Gid>\\n" + " </IncoTermGid>\\n" + " </CommercialTerms>\\n" + " <IsTemplate>N</IsTemplate>\\n" + " <BundlingType>AUTOMATIC</BundlingType>\\n" + " <IsSplitAllowed>Y</IsSplitAllowed>\\n" + " <IsShipperKnown>N</IsShipperKnown>\\n" + " <OrderPriority>1</OrderPriority>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " <FlexFieldCurrencies/>\\n" + " </ReleaseHeader>\\n" + " <ShipFromLocationRef>\\n" + " <LocationRef>\\n" + " <LocationGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>HW_DGFAC_CHINA</Xid>\\n" + " </Gid>\\n" + " </LocationGid>\\n" + " </LocationRef>\\n" + " </ShipFromLocationRef>\\n" + " <ShipToLocationRef>\\n" + " <LocationRef>\\n" + " <LocationGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>KW_L1</Xid>\\n" + " </Gid>\\n" + " </LocationGid>\\n" + " </LocationRef>\\n" + " </ShipToLocationRef>\\n" + " <TimeWindow>\\n" + " <PickupIsAppt>N</PickupIsAppt>\\n" + " <DeliveryIsAppt>N</DeliveryIsAppt>\\n" + " </TimeWindow>\\n" + " <ReleaseLine>\\n" + " <ReleaseLineGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>220</Xid>\\n" + " </Gid>\\n" + " </ReleaseLineGid>\\n" + " <PackagedItemRef>\\n" + " <PackagedItem>\\n" + " <Packaging>\\n" + " <PackagedItemGid>\\n" + " <Gid>\\n" + " <Xid>DEFAULT</Xid>\\n" + " </Gid>\\n" + " </PackagedItemGid>\\n" + " <IsHandlingUnitStackable>Y</IsHandlingUnitStackable>\\n" + " <IsDefaultPackaging>N</IsDefaultPackaging>\\n" + " <IsHazardous>N</IsHazardous>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " <IsAllowMixedFreight>Y</IsAllowMixedFreight>\\n" + " </Packaging>\\n" + " <Item>\\n" + " <TransactionCode>IU</TransactionCode>\\n" + " <ItemGid>\\n" + " <Gid>\\n" + " <Xid>DEFAULT</Xid>\\n" + " </Gid>\\n" + " </ItemGid>\\n" + " <IsDrawback>N</IsDrawback>\\n" + " <PricePerUnit>\\n" + " <FinancialAmount>\\n" + " <GlobalCurrencyCode>USD</GlobalCurrencyCode>\\n" + " <MonetaryAmount>0.0</MonetaryAmount>\\n" + " <FuncCurrencyAmount>0.0</FuncCurrencyAmount>\\n" + " </FinancialAmount>\\n" + " </PricePerUnit>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " </Item>\\n" + " </PackagedItem>\\n" + " </PackagedItemRef>\\n" + " <ItemQuantity>\\n" + " <WeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </WeightVolume>\\n" + " <PackagedItemCount>14</PackagedItemCount>\\n" + " <DeclaredValue>\\n" + " <FinancialAmount>\\n" + " <GlobalCurrencyCode>USD</GlobalCurrencyCode>\\n" + " <MonetaryAmount>0.0</MonetaryAmount>\\n" + " <FuncCurrencyAmount>0.0</FuncCurrencyAmount>\\n" + " </FinancialAmount>\\n" + " </DeclaredValue>\\n" + " </ItemQuantity>\\n" + " <IsDrawback>N</IsDrawback>\\n" + " <IsSplitAllowed>Y</IsSplitAllowed>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " </ReleaseLine>\\n" + " <ShipUnit>\\n" + " <ShipUnitGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>221</Xid>\\n" + " </Gid>\\n" + " </ShipUnitGid>\\n" + " <TransactionCode>IU</TransactionCode>\\n" + " <WeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </WeightVolume>\\n" + " <UnitNetWeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </UnitNetWeightVolume>\\n" + " <TotalGrossWeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </TotalGrossWeightVolume>\\n" + " <ShipUnitContent>\\n" + " <PackagedItemRef>\\n" + " <PackagedItem>\\n" + " <Packaging>\\n" + " <PackagedItemGid>\\n" + " <Gid>\\n" + " <Xid>DEFAULT</Xid>\\n" + " </Gid>\\n" + " </PackagedItemGid>\\n" + " <IsHandlingUnitStackable>Y</IsHandlingUnitStackable>\\n" + " <IsDefaultPackaging>N</IsDefaultPackaging>\\n" + " <IsHazardous>N</IsHazardous>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " <IsAllowMixedFreight>Y</IsAllowMixedFreight>\\n" + " </Packaging>\\n" + " <Item>\\n" + " <TransactionCode>IU</TransactionCode>\\n" + " <ItemGid>\\n" + " <Gid>\\n" + " <Xid>DEFAULT</Xid>\\n" + " </Gid>\\n" + " </ItemGid>\\n" + " <IsDrawback>N</IsDrawback>\\n" + " <PricePerUnit>\\n" + " <FinancialAmount>\\n" + " <GlobalCurrencyCode>USD</GlobalCurrencyCode>\\n" + " <MonetaryAmount>0.0</MonetaryAmount>\\n" + " <FuncCurrencyAmount>0.0</FuncCurrencyAmount>\\n" + " </FinancialAmount>\\n" + " </PricePerUnit>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " </Item>\\n" + " </PackagedItem>\\n" + " </PackagedItemRef>\\n" + " <LineNumber>1</LineNumber>\\n" + " <ItemQuantity>\\n" + " <IsSplitAllowed>N</IsSplitAllowed>\\n" + " <WeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </WeightVolume>\\n" + " <PackagedItemCount>14</PackagedItemCount>\\n" + " </ItemQuantity>\\n" + " <ReleaseGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>000032160036AHHWA04K</Xid>\\n" + " </Gid>\\n" + " </ReleaseGid>\\n" + " <ReleaseLineGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>220</Xid>\\n" + " </Gid>\\n" + " </ReleaseLineGid>\\n" + " <NetWeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </NetWeightVolume>\\n" + " </ShipUnitContent>\\n" + " <IsSplitAllowed>N</IsSplitAllowed>\\n" + " <IsCountSplittable>Y</IsCountSplittable>\\n" + " <ShipUnitCount>1</ShipUnitCount>\\n" + " <IsRepackAllowed>N</IsRepackAllowed>\\n" + " <FlexFieldStrings/>\\n" + " <FlexFieldNumbers/>\\n" + " <FlexFieldDates/>\\n" + " </ShipUnit>\\n" + " <TotalWeightVolume>\\n" + " <WeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </WeightVolume>\\n" + " </TotalWeightVolume>\\n" + " <TotalNetWeightVolume>\\n" + " <Weight>\\n" + " <WeightValue>2.62</WeightValue>\\n" + " <WeightUOMGid>\\n" + " <Gid>\\n" + " <Xid>MTON</Xid>\\n" + " </Gid>\\n" + " </WeightUOMGid>\\n" + " </Weight>\\n" + " <Volume>\\n" + " <VolumeValue>0.2</VolumeValue>\\n" + " <VolumeUOMGid>\\n" + " <Gid>\\n" + " <Xid>CUMTR</Xid>\\n" + " </Gid>\\n" + " </VolumeUOMGid>\\n" + " </Volume>\\n" + " </TotalNetWeightVolume>\\n" + " <TotalPackagedItemCount>14</TotalPackagedItemCount>\\n" + " <ReleaseRefnum>\\n" + " <ReleaseRefnumQualifierGid>\\n" + " <Gid>\\n" + " <Xid>GLOG</Xid>\\n" + " </Gid>\\n" + " </ReleaseRefnumQualifierGid>\\n" + " <ReleaseRefnumValue>HWPOC.000032160036AHHWA04K</ReleaseRefnumValue>\\n" + " </ReleaseRefnum>\\n" + " <ReleaseStatus>\\n" + " <StatusTypeGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>ORDER_RELEASE GUARANTEED DELIVERY</Xid>\\n" + " </Gid>\\n" + " </StatusTypeGid>\\n" + " <StatusValueGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>ORDER_RELEASE GUARANTEED DELIVERY_NOT STARTED</Xid>\\n" + " </Gid>\\n" + " </StatusValueGid>\\n" + " </ReleaseStatus>\\n" + " <ReleaseStatus>\\n" + " <StatusTypeGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>PLANNING</Xid>\\n" + " </Gid>\\n" + " </StatusTypeGid>\\n" + " <StatusValueGid>\\n" + " <Gid>\\n" + " <DomainName>HWPOC</DomainName>\\n" + " <Xid>PLANNING_NEW</Xid>\\n" + " </Gid>\\n" + " </StatusValueGid>\\n" + Tomcat
求救Java怎么调用 net的webService
SSH整合
Ocelot api gateway - kubernetes - error: "namespace:serviceservice:managementservice Unable to
java调用webservice怎么添加 SoapHeader 做验证
重构手法之简化函数调用
|